我开始学习如何将 theano 与千层面一起使用,并从 mnist 示例开始。现在,我想尝试我自己的示例:我有一个 train.csv 文件,其中每一行以 0 或 1 开头,代表正确答案,然后是 773 个 0 和 1,代表输入。我不明白如何在 load_database() 函数中将此文件转换为所需的 numpy 数组。这是 mnist 数据库的原始函数的一部分:
...
with gzip.open(filename, 'rb') as f:
data = pickle_load(f, encoding='latin-1')
# The MNIST dataset we have here consists of six numpy arrays:
# Inputs and targets for the training set, validation set and test set.
X_train, y_train = data[0]
X_val, y_val = data[1]
X_test, y_test = data[2]
...
# We just return all the arrays in order, as expected in main().
# (It doesn't matter how we do this as long as we can read them again.)
return X_train, y_train, X_val, y_val, X_test, y_test
我需要从我的 csv 文件中获取 X_train (输入)和 y_train (每一行的开头)。
谢谢!