15 手写数字识别-小数据集

1.手写数字数据集

  • from sklearn.datasets import load_digits
  • digits = load_digits()

 

2.图片数据预处理

  • x:归一化MinMaxScaler()
  • y:独热编码OneHotEncoder()或to_categorical
  •  

     

  • 训练集测试集划分
  • 张量结构
  • X_train, X_test, y_train, y_test = train_test_split(XL, Y, test_size=0.2, random_state=0, stratify=Y)
    print('X_train.shape, X_test.shape, y_train.shape, y_test.shape:', X_train.shape, X_test.shape, y_train.shape, y_test.shape)

3.设计卷积神经网络结构

  • 绘制模型结构图,并说明设计依据。
  •  

     

4.模型训练

 

 

 

 

5.模型评价

  • model.evaluate()
  • 交叉表与交叉矩阵
  • pandas.crosstab
  • seaborn.heatmap
  •  

     

     

     

posted @ 2020-06-09 22:09  荔枝干  阅读(252)  评论(0编辑  收藏  举报