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

squared_error: Warn if comparing column vector against row vector #755

Closed
f0k opened this issue Oct 17, 2016 · 2 comments
Closed

squared_error: Warn if comparing column vector against row vector #755

f0k opened this issue Oct 17, 2016 · 2 comments
Milestone

Comments

@f0k
Copy link
Member

f0k commented Oct 17, 2016

At least one user got trapped by setting target_var to a vector for a regression task, and then passing it to lasagne.objectives.squared_error along with the network predictions for a network of a single output unit: https://groups.google.com/forum/#!topic/lasagne-users/DsSY1cHCC2M

Due to #715, Theano knows that the network predictions are a column vector (a matrix with broadcast pattern (False, True)), so it will happily broadcast the network predictions and the targets into a square matrix of (batchsize, batchsize) and compute the squared differences between every prediction and every target (as opposed to computing the squared differences between corresponding predictions and targets only). The mean of the loss is still a scalar, so training will appear to work, but not learn anything.

We should catch this case and warn the user to use a column vector for the squared error targets.

@f0k
Copy link
Member Author

f0k commented Nov 20, 2016

We should catch this case and warn the user to use a column vector for the squared error targets.

Maybe it's even better to just support this case, and turn a 1D target vector into a column vector if needed. This closes the trap and also circumvents the log sigmoid stabilization not being applied for binary classification (if we encourage users to use a target vector for single outputs). PR in #770.

@jingriver
Copy link

2016年11月20日星期日,Jan Schlüter notifications@github.com 写道:

We should catch this case and warn the user to use a column vector for the
squared error targets.

Maybe it's even better to just support this case, and turn a 1D target
vector into a column vector if needed. This closes the trap and also
circumvents the log sigmoid stabilization not being applied for binary
classification (if we encourage users to use a target vector for single
outputs). PR in #770 #770.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#755 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGkOJrv4wBp7dr7NGmKy2xYz2oDVr3Ixks5rAM9VgaJpZM4KYlSu
.

@f0k f0k closed this as completed in #770 Nov 27, 2016
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