



softmax回归实现mnist数据集分类python代码:
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import struct
#image是一个n*m的数组,n是样本数(行数),m是特征数(列数)。训练数据集包含60000个样本,测试数据集包含10000个样本。在mnist数据集中的每张图片由28*28个像素点构成,每个像素点用一个灰度值表示。我们将28*28的像素展开为一个一维的行向量(每行784个值,或者说每行代表一张图片)。
#label包含相应的目标变量,也就是手写数字的类标签(整数0-9)。
image = []; label = []; testImage = []; testLabel = []
trainData = 60000; testData = 10000
fileImage = 'D:\\Python\\pythonAZ\\Lib\\idlelib\\mnist\\train-images.idx3-ubyte' #训练数据集路径
fileLabel = 'D:\\Python\\pythonAZ

773

被折叠的 条评论
为什么被折叠?



