As part of a personal project, I am trying to change the example code specified in the documentation of Theano ( Multilayer Percept ) with my own data.
So far I have managed to bring my (text) data in the required format, and I want to build a binary classifier. The fact is that when I write that the number of outputs is 1 ie
classifier = MLP(rng=rng, input=x, n_in=49, n_hidden=n_hidden, n_out=1)
I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Asterios\Anaconda\lib\site-packages\spyderlib\widgets\externalshell \sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "C:/Users/Asterios/Documents/Python/TripAdvisor/untitled4.py", line 603, in <module>
params = test_mlp()
File "C:/Users/Asterios/Documents/Python/TripAdvisor/untitled4.py", line 553, in test_mlp
minibatch_avg_cost = train_model(minibatch_index)
File "C:\Users\Asterios\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\function_module.py", line 588, in __call__
self.fn.thunks[self.fn.position_of_error])
File "C:\Users\Asterios\Anaconda\lib\site-packages\theano-0.6.0-py2.7.egg\theano\compile\function_module.py", line 579, in __call__
outputs = self.fn()
ValueError: y_i value out of bounds
Apply node that caused the error: CrossentropySoftmaxArgmax1HotWithBias(Dot22.0, b, Elemwise{Cast{int32}}.0)
Inputs shapes: [(10L, 1L), (1L,), (10L,)]
Inputs strides: [(8L, 8L), (8L,), (4L,)]
Inputs types: [TensorType(float64, matrix), TensorType(float64, vector), TensorType(int32, vector)]
Use the Theano flag 'exception_verbosity=high' for a debugprint of this apply node.
The output of my workouts (before using a general view like anano):
array([1, 1, 1, ..., 0, 0, 0], dtype=int64)
The strange thing is that if I use ANYTHING above 1 as the number of output neurons (for example, n_out = 2), the code works without errors, but, of course, now there are many output neurons that have no practical meaning.
- , , , ? ?
!