datagenerator.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:MNIST-Neural-Net 作者: MLavrentyev 项目源码 文件源码
def genTrainData(self):
        data = []
        with open('../train-data.csv', 'r') as f:
            data = [list(map(int,rec)) for rec in csv.reader(f, delimiter=',')]

        data = np.array(data)
        labels = data[:,0]
        data = np.delete(data, 0, 1)

        data = np.split(data, [(int)(data.shape[0]*.75)])[0]
        labels = np.split(labels, [(int)(labels.shape[0]*.75)])[0]

        testData = np.split(data, [(int)(data.shape[0]*.75)])[1]
        testLabels = np.split(labels, [(int)(labels.shape[0]*.75)])[1]

        return data, labels, testData, testLabels
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号