-
Notifications
You must be signed in to change notification settings - Fork 259
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
Add NeuralNet.partial_fit method that trains for only one epoch #147
Conversation
An idea for discussion: fit could have a num_epochs keyword that allows to override the self.max_epochs if set to something other than None, which is the default. Although this is a departure from sklearn's way, it should not interfere and is a little bit more flexible. partial_fit would then just call fit(X, y, num_epochs=1). On a more general note, is partial_fit the right term here? My understanding of sklearn's partial_fit is that it allows to learn on a subset of the total data (hence you have to explicitely pass the classes). This is not what is done here. fit already allows to train on part of the data and classes are defined by the architecture. |
00ec431
to
7d6887d
Compare
Good point about passing a I've also made it accept a The main idea here is to allow the user to "take control" of the training loop, e.g. for X_epoch, y_epoch in generate_data(X, y):
net.partial_fit(X_epoch, y_epoch) (Of course you can set I think this use case is pretty much in line with the kind of "online learning" that scikit-learn allows you to do with I'm not sure about the other issues you mention. I think this would solve #69 already, as I can now define the size of one epoch to be as small as I want, and thus get feedback much quicker. Let me know what you think. |
I see why #69 is probably solved with this. I wondered whether it would be possible to somehow cram the issue with callbacks after epochs into this, but that is probably better left for another day. |
7d6887d
to
1babe2c
Compare
OK, thanks for the clarification. I get what you mean now. I guess the fact that I'll make sure to point out in the docstring of |
Can't this be solved by using a sufficiently small epoch size and |
Definitely.
Yeah, its possible that way. If this were something that more people needed, I believe it would still make sense to implement something like an |
Add NeuralNet.partial_fit method that trains for only one epoch
As suggested in Lasagne/Lasagne#12 (comment)