Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another feature request for predict #12

Open
sdemyanov opened this issue Aug 18, 2015 · 1 comment
Open

Another feature request for predict #12

sdemyanov opened this issue Aug 18, 2015 · 1 comment

Comments

@sdemyanov
Copy link

Hi Anders,

Could you also add an option to view the probabilities in 'predict'?
I tried to do it by myself:

  1. In class SoftmaxCrossEntropy I changed the function 'fprop' on
    def fprop(self, x):
    sm = self._softmax(x)
    return ca.nnet.one_hot_decode(sm), sm

  2. in class NeuralNetwork I change the function 'predict' to return both predictions and probabilities

  3. in 'test_error()' I read two values:
    y, yp = net.predict(test_input)

However, I always get an error 'too many values to unpack' for the 'test_error" function, which means that I do not reload it properly. Could you also explain how to do it correctly? Surprisingly I find two sources: in deeppy/deeppy and deeppy/build/lib/deeppy. Moreover, the upstack error appears in '/anaconda/lib/python2.7/site-packages/deeppy-0.1.dev0-py2.7.egg/deeppy/train/sgd.py', in the function 'val_error = val_error_fun()'. Could you clarify these details please?

Regards,
Sergey.

@andersbll
Copy link
Owner

Hi Sergey!

Just return the probabilities:

def fprop(self, x):
    return self._softmax(x)

I think you should also change the behavior of y_shape() to match the new array size. You can always get the class labels with numpy.argmax(). :)

I should say that I plan on changing the NeuralNetwork interface for more flexibility at test time.

Best,
Anders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants