-
Notifications
You must be signed in to change notification settings - Fork 50
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
ENH: Support routed parameters to callbacks #233
Conversation
Codecov Report
@@ Coverage Diff @@
## master #233 +/- ##
==========================================
- Coverage 99.71% 98.90% -0.82%
==========================================
Files 6 6
Lines 693 728 +35
==========================================
+ Hits 691 720 +29
- Misses 2 8 +6
Continue to review full report at Codecov.
|
📝 Docs preview for commit c88d277 at: https://www.adriangb.com/scikeras/refs/pull/233/merge/ |
I am ambivalent on these changes being merged. The ugly syntax reduces my motivation. Is |
Thank you for the quick feedback! Is there anything else, aside from the ugly syntax, that makes you doubtful? Does it seem non-useful or anything? I agree, it's not the prettiest. I think your proposal should work (it may work as-is, if not, I'm fairly certain it can be made to work). |
I was able to incorporate your feedback, and also support with/without the |
Is it common to have only one callback? It might be worth adding support for not passing a list/dict to callbacks then. That'd enable this syntax: KerasEstimator(...
callbacks=keras.callbacks.LearningRateScheduler,
callbacks__0=Schedule,
callbacks__0__coef=0.2,
) I think that's a lot cleaner. I suppose this could also be enabled by having a
I misspoke; I meant to say "is
In Keras parlance, is "callback" synonymous with "fit callback"? Or, in SciKeras parlance, could I have |
I think it's fairly common.
Keras does not have a # class list syntax
KerasClassifier(
callbacks=[tf.keras.callbacks.EarlyStopping]
callbacks__0__monitor="loss",
)
# class dict syntax
KerasClassifier(
callbacks={"es": tf.keras.callbacks.EarlyStopping}
callbacks__es__monitor="loss",
)
# single class syntax
KerasClassifier(
callbacks=tf.keras.callbacks.EarlyStopping
callbacks__monitor="loss",
)
# object list syntax
KerasClassifier(
callbacks=[tf.keras.callbacks.EarlyStopping(monitor="loss")]
)
# object dict syntax
KerasClassifier(
callbacks={"es": tf.keras.callbacks.EarlyStopping(monitor="loss")}
)
# single object syntax
KerasClassifier(
callbacks=tf.keras.callbacks.EarlyStopping(monitor="loss")
)
As per above, it will be possible.
This is actually a really good point. In Keras, you can have callbacks for both We can support this as well, using
And also:
|
Co-authored-by: Scott Sievert <[email protected]>
Co-authored-by: Scott Sievert <[email protected]>
Co-authored-by: Scott Sievert <[email protected]>
Co-authored-by: Scott Sievert <[email protected]>
Co-authored-by: Scott Sievert <[email protected]>
The nightly failures are the same in master, so I'm going to merge this regardless. |
Closes #232
TODO:
fit__
prefix.