zoukankan      html  css  js  c++  java
  • KNN实现mnist、fashion mnist数据集的分类

    一、遇到的问题小结

    1.python读取数据集文件,因为路径的问题总是报错,错误是no file directory,改了很久,最后正确的示例(要注意的一点就是一定要仔细核对,我有一个地方将‘-’变成了‘.’竟然报错OSError,一下子懵逼,后面才发现写错了):

    2.python的struct.pack_into函数

    struct.pack_into(fmt, buffer, offset, v1, v2, ...)

    Pack the values v1, v2, ... according to the format string fmt and write the packed bytes into the writable buffer buffer starting at position offset. Note that offset is a required argument.

    按照指定的格式fmt,将v1,v2...打包到buffer中,其中偏移位置为offset

    3. python的struct.pack_from函数

    struct.unpack_from(fmt, buffer, offset=0)

    Unpack from buffer starting at position offset, according to the format string fmt. The result is a tuple even if it contains exactly one item. The buffer’s size in bytes, minus offset, must be at least the size required by the format, as reflected by calcsize().

    按照指定的格式fmt,从偏移位置offset开始解包,返回数据格式是一个元组(v1,v2...)

    参考链接:https://www.aliyun.com/jiaocheng/526451.html

    4. shape函数是numpy.core.fromnumeric中的函数,它的功能是查看矩阵或者数组的维数。

    参考链接:https://blog.csdn.net/u010758410/article/details/71554224

    5. tile函数。

    原型:numpy.tile(A,reps)

    tile共有2个参数,A指待输入数组,reps则决定A重复的次数。整个函数用于重复数组A来构建新的数组。

    一生有所追!
  • 相关阅读:
    Sectong日志分析
    风暴中心
    安全趋势:
    Mysql table ful
    linux service命令常见使用方法
    client denied by server configuration
    Ubuntu配置apache
    O2O助汪峰成功逆袭,汪峰最终上头条了
    Android切图注意事项
    2014/08/23——OJ及相关站点打开速度非常慢,训练计划login直接error!
  • 原文地址:https://www.cnblogs.com/BlueBlue-Sky/p/9296722.html
Copyright © 2011-2022 走看看