with_callbacks#
- sklearn.callback.with_callbacks(method)[source]#
Decorator to run the method within a callback context manager.
This decorator is responsible for calling the callbacks
teardownhooks of callbacks in atry finallyblock, which guarantees that callbacks teardown will always be called, whether the estimator’s method exits successfully or not.It will only teardown callbacks that are not propagated from a meta-estimator.
- Parameters:
- methodmethod
The method to decorate.
- Returns:
- decorated_methodmethod
The decorated method.