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 SklearnCallback as integration with sklearn metrics #1198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please integrate the Callback to a minimal example to check the performance?
from catalyst.metrics import FunctionalBatchMetric | ||
|
||
|
||
class SklearnCallback(FunctionalBatchMetricCallback): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to also add loader-based sklearn metrics into the separate Callback?
we could not compute AUCs in per-batch mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevertheless, we could just filter the loader-based metrics during metric_fn check for now
to simplify the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I filter by name?.. or how?
cb6e1fd
to
4fdfc56
Compare
@y-ksenia btw you can test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please also update Config API example with extra SklearnCallback?
callbacks["f1_score"] = dl.SklearnCallback( | ||
keys={ | ||
"y_pred": "labels", | ||
"y_true": "targets", | ||
"average": "micro", | ||
"zero_division": 1, | ||
}, | ||
metric_fn="f1_score", | ||
metric_key="f1_score", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add this example to the callbacks docs? it's very interesting, that you could also pass metrics **kwargs through the keys
This pull request is now in conflicts. @y-ksenia, could you fix it? 🙏 |
…s to sklearn score
dc2b091
to
50525a5
Compare
…way of passing arguments into metric_fn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like only changelog.md update required :)
This pull request is now in conflicts. @y-ksenia, could you fix it? 🙏 |
* Update CHANGELOG.md * Add Registry to batch transform callback (#1209) * add registry * fix docs * fix docs and codestyle. Add example * fix line length :) * add registry.py * codestyle * fix * add partial and kwargs * Fix data: imports (#1211) * notebooks update v1 * notebooks update v2 * notebooks update v2 * notebooks update v2 * minimal RL * minimal RL * minimal RL 2 * rl update * rl update * demo update * demo update * demo update * demo update * tests update * tests update * import fix * readme * Change layerwise to layerwise_params (#1210) * Change layerwise to layerwise_params (rus version) At the old version was incorrect key layerwise to set lr, weight_decay and other params for different model layers. Also add example how to add extra params to DataLoader * Change layerwise to layerwise_params (eng version) At the old version was incorrect key layerwise to set lr, weight_decay and other params for different model layers. Also add example how to add extra params to DataLoader * [WIP] faq docs (#1202) * initial * docs: engines initial * docs: engines initial * fix: python api; feature: config api example * docs: reverted back * docs: spelling; engine functions explained * fix: note in changelog about faq docs * Update CHANGELOG.md (#1216) * fix: to_numpy wrapper for `AdditiveValueMetric` added (#1214) * tests update + readme (#1215) * tests update + readme * readme * workflows changed * workflows * readme * Fix compute method (#1206) * add DynamicBalanceClassSampler * add DynamicBalanceClassSampler: add usage example * add DynamicBalanceClassSampler: add tests * Update catalyst/data/tests/test_sampler.py * Update catalyst/data/tests/test_sampler.py * add DynamicBalanceClassSampler: debag tests * update sampler: add mode * add example notebook * sampler: fixes * samler: docs * DynamicBalanceClassSampler: fixes * change import order * change import order * Fix compute problem * Delete sampler * Replace compute method * Update segmentation tests * Codestyle * Add test for compute * Add examples Co-authored-by: Sergey Kolesnikov <scitator@gmail.com> * Update ddt.rst (#1217) Change in Case-3 code, Now running the code under name==__main__ (due to python's multiprocessing logic) * docker update (#1218) * docker update * docker update * docs update (#1219) * Updated NeptuneLogger docstrings (#1223) * fixed import in example, changed .ml -> .ai * fixed long lines, added NeptuneLogger Callback * fixed NeptuneLogger imports * fixed newline formating * fixed line length and import order * fixed bad quotes * fixed bad quotes * vanilla impl [WIP] * fixed hparams * applied new structure to run * corrected log image path * added log_artifact to catalyst * Updated log_artifact docstring * simplified logger, added log artifact * log to 'experiment' scope is scope is None * fixed artifact logging * better structure of the run * code style adjustments * added neptune requirements to the workflow * typo fix * dropped repetition in requirements * codestyle fixes * filename fix * Corrected docstring to be 1-liner. * Update catalyst/loggers/neptune.py Co-authored-by: Sergey Kolesnikov <scitator@gmail.com> * Final touches & test fixes * Checkstyle fixes * Missed code style * Revert stop to wait * Fix failing test * Comment indentation * fix tests * Fix * Fix * fix * Fix * Updated CHANGELOG and loggers docs * Fix * Update setup.py Co-authored-by: Sergey Kolesnikov <scitator@gmail.com> * updated neptune docstrings * style fixed * updated changelog * typo fix Co-authored-by: Jakub Czakon <czakon.jakub@gmail.com> Co-authored-by: Sergey Kolesnikov <scitator@gmail.com> Co-authored-by: Hubert Jaworski <hubert.jaworski@neptune.ai> Co-authored-by: Marcin Mycek <herudaio@gmail.com> * remove unnecessary thing * Update catalyst/callbacks/batch_transform.py * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Sergey Kolesnikov <scitator@gmail.com> Co-authored-by: MrNightSky <39031563+MrNightSky@users.noreply.github.com> Co-authored-by: Dmytro Doroshenko <dimdoroshenko@gmail.com> Co-authored-by: Yauheni Kachan <19803638+bagxi@users.noreply.github.com> Co-authored-by: Dokholyan <37542142+Dokholyan@users.noreply.github.com> Co-authored-by: Riyasat Ohib <riyasat.ohib@gmail.com> Co-authored-by: Kamil A. Kaczmarek <kamil.kaczmarek@neptune.ml> Co-authored-by: Jakub Czakon <czakon.jakub@gmail.com> Co-authored-by: Hubert Jaworski <hubert.jaworski@neptune.ai> Co-authored-by: Marcin Mycek <herudaio@gmail.com> * add SklearnCallback as integration with sklearn metrics (#1198) * added SklearnCallback as integration with sklearn metrics * codestyle * renamed script to exclude error in imports; added option to add params to sklearn score * added import if sklearn is available in extensions * added test * docstrings * updated docstring: added example for pass metrics kwargs as keys * added note to callback * added FunctionalLoaderMetric and SklearnLoaderCallback; modified the way of passing arguments into metric_fn * codestyle fixes * fixed test for new version of SklearnBatchCallback * added __all__ * added classes to docs * codestyle * fixed docs; and small pep8-bugs * updated changelog * codestyle * codestyle2 Co-authored-by: Nikita Balagansky <37884009+elephantmipt@users.noreply.github.com> Co-authored-by: MrNightSky <39031563+MrNightSky@users.noreply.github.com> Co-authored-by: Dmytro Doroshenko <dimdoroshenko@gmail.com> Co-authored-by: Yauheni Kachan <19803638+bagxi@users.noreply.github.com> Co-authored-by: Dokholyan <37542142+Dokholyan@users.noreply.github.com> Co-authored-by: Riyasat Ohib <riyasat.ohib@gmail.com> Co-authored-by: Kamil A. Kaczmarek <kamil.kaczmarek@neptune.ml> Co-authored-by: Jakub Czakon <czakon.jakub@gmail.com> Co-authored-by: Hubert Jaworski <hubert.jaworski@neptune.ai> Co-authored-by: Marcin Mycek <herudaio@gmail.com> Co-authored-by: Kseniia Iagafarova <xeniayagafarova@gmail.com>
Before submitting (checklist)
catalyst-make-codestyle && catalyst-check-codestyle
(pip install -U catalyst-codestyle
).make check-docs
?pytest .
?latest
andminimal
requirements?Description
Work on #1183
Related Issue
Type of Change
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
FAQ
Please review the FAQ before submitting an issue: