Monday, 27 April 2015

Binary output Neural Network in Python Theano

The logistic regression class used as output layer in the MLP tutorial is not the "standard" logistic regression, which gives as output a single value and discriminates between just two classes, but rather a Multinomial Logistic Regression (a.k.a Softmax Regression), which gives as output one value for each class, telling the probability of the input belonging to them. So, if you have 10 classes, you'll also need 10 units and obviously the sum of all output units equals 1, since it's a probability distribution.
Despite of the class name used ("LogistRegression"), its doctring in the linked source code leaves no doubts of its real intent ('''Multi-class Logistic Regression Class [...]''').
Whereas in your problem you have two classes, you'll also need 2 output units and the value for your n_out must be 2 instead of 1. Of course, with two classes the value for one output will be always 1 minus the value of the other.
Also, check if you really need int64 instead of int32. Theano has much better support for the second.

No comments :

Post a Comment