I am using pybrain to classify some data and my input data is a ndarray with 73 features and the output should be 0 and 1. And I have the test data which only have the input of the features but not the output. So I want to use the neural network trainer to get the output of my classification which is 0 or 1. My code is like this:
ds = ClassificationDataSet(73, 1, nb_classes=2)
for i in range(len(new_train_X)):
ds.addSample(new_train_X[i],y[i])
ds._convertToOneOfMany()
net = buildNetwork(73,2,2, outclass=SoftmaxLayer)
trainer = BackpropTrainer(net,dataset=ds,momentum=0.1,verbose=True,weightdecay=0.01)
trainer.trainOnDataset(ds)
Then I have the test data with is a nd-array without the output value:
test_result = net.activateOnDataset(test_data).argmax(axis=1)
But it could not return the desired output. The result output should be an array with 0 or 1 and the array should be the same length compared with the input data. Is there anything wrong for that? I checked the documentation and it seems that you could only use the train data and do the cross validation. The error is like this: AttributeError: 'numpy.ndarray' object has no attribute 'reset' Is there any problem for the format of my test-data?