Closed taroyutao closed 6 years ago
change the mnist_loader.py
tr_d, va_d, te_d = load_data()
training_inputs = [np.reshape(x, (784, 1)) for x in tr_d[0]]
training_results = [vectorized_result(y) for y in tr_d[1]]
training_data = list(zip(training_inputs, training_results))
validation_inputs = [np.reshape(x, (784, 1)) for x in va_d[0]]
validation_data = list(zip(validation_inputs, va_d[1]))
test_inputs = [np.reshape(x, (784, 1)) for x in te_d[0]]
test_data = list(zip(test_inputs, te_d[1]))
return (training_data, validation_data, test_data)
I have tried changing the mnist_loader by wrapping the zip command with list, but it's not working.
sample_training_data = list(training_data) sample_training_data = sample_training_data[:1000]
change training_data[:1000] with sample_training_data
The network1's demo works ok by python352, but when i run the following script: import mnist_loader training_data, validation_data, test_data = mnist_loader.load_data_wrapper() import network2 net = network2.Network([784, 30, 10], cost=network2.CrossEntropyCost) net.large_weight_initializer() net.SGD(training_data[:1000], 400, 10, 0.5, evaluation_data=test_data,monitor_evaluation_accuracy=True, monitor_training_cost=True)
something wrong: net.SGD(training_data[:1000], 400, 10, 0.5, evaluation_data=test_data,monitor_evaluation_accuracy=True, monitor_training_cost=True) TypeError: 'zip' object is not subscriptable
i have try to change zip() to list(zip()) ,but it's doesn't work. do you have any suggestion?