【发布时间】:2016-05-25 09:42:21
【问题描述】:
我一直在尝试使用tflearn 和我自己的数据集执行回归。
使用 tflearn 我一直在尝试使用 MNIST 数据集实现基于 example 的卷积网络。我没有使用 MNIST 数据集,而是尝试用自己的数据替换训练和测试数据。我的数据是从 csv 文件中读取的,与 MNIST 数据的形状不同。我有 255 个特征,它们代表一个 15*15 的网格和一个目标值。在示例中,我将第 24-30 行替换为(并包括 import numpy as np):
#read in train and test csv's where there are 255 features (15*15) and a target
csvTrain = np.genfromtxt('train.csv', delimiter=",")
X = np.array(csvTrain[:, :225]) #225, 15
Y = csvTrain[:,225]
csvTest = np.genfromtxt('test.csv', delimiter=",")
testX = np.array(csvTest[:, :225])
testY = csvTest[:,225]
#reshape features for each instance in to 15*15, targets are just a single number
X = X.reshape([-1,15,15,1])
testX = testX.reshape([-1,15,15,1])
## Building convolutional network
network = input_data(shape=[None, 15, 15, 1], name='input')
我收到以下错误:
ValueError: 无法为张量 u'target/Y:0' 提供形状 (64,) 的值, 形状为 '(?, 10)'
我尝试了各种组合,并在 stackoverflow 中看到了 similar question,但没有成功。此页面中的示例对我不起作用并引发类似错误,我不理解提供的答案或类似问题提供的答案。
我如何使用自己的数据?
【问题讨论】:
标签: python tensorflow deep-learning