question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make partial_fit force a single iteration

See original GitHub issue

Currently partial_fit and fit + warm_start have the same behavior. I think it would be more useful if we followed SGD’s example and trained for exactly one epoch when partial_fit is called, regardless of the value of epochs/n_iter passed to __init__.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
stsievertcommented, Oct 16, 2020

Yup. I’m working on a PR for that right now, and it’s pretty easy.

1reaction
stsievertcommented, Oct 16, 2020

The workaround to making [SciKeras] work correctly with HyperbandSearchCV would be not to specify the epochs in the initialization so that epochs=1.

Yes. That’s correct. SciKeras should use epochs=1 to fit inside of HyperbandSearchCV’s rule of thumb. I would probably specify this manually because I don’t like relying on defaults.

Of course, epochs=2 will not throw any errors, but it will require a small modification of the rule of thumb.

Does that answer your question?

In the current implementation …

I think you’re largely correct. Here’s what happens right now:

  • HyperbandSearchCV’s treats one iteration in max_iter as one partial_fit call.*
  • In most Scikit-learn models, one partial_fit call corresponds to one pass through the dataset (e.g, MLPRegressor, SGDRegressor).
  • In the current implementation of SciKeras, partial_fit and fit perform the same action and train for all epochs, not a single pass through the dataset.

*As detailed in Hyperband’s rule of thumb, the number of examples for each call should vary

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incremental Learning with sklearn: warm_start, partial_fit(), fit()
Answering my own question after some investigation: warm_start=True and calling .fit() sequentially should not be used for incremental ...
Read more >
How to increase the number of iterations to optimize my cost ...
You can simply use the fit() method instead of the partial_fit() method and increase the max_iter by providing an integer value for the ......
Read more >
sklearn.decomposition.IncrementalPCA
Incremental fit with X. All of X is processed as a single batch. Parameters: Xarray-like of shape (n_samples, n_features).
Read more >
Customize what happens in Model.fit | TensorFlow Core
Let's start from a simple example: We create a new class that subclasses keras.Model . We just override the method train_step(self, data) ....
Read more >
Gradient Descent Algorithm and Its Variants | by Imad Dabbura
Optimization algorithm that is not iterative and simply solves for one point. ... On each iteration, take the partial derivative of the cost...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found