AutoPropagatedCallback#
- class sklearn.callback.AutoPropagatedCallback(*args, **kwargs)[source]#
Protocol for the auto-propagated callbacks
An auto-propagated callback is a callback that is meant to be set on a top-level estimator and that is automatically propagated to its sub-estimators (if any).
- property max_propagation_depth#
The maximum number of nested estimators at which the callback should be propagated.
If set to None, the callback is propagated to sub-estimators at all nesting levels.
- setup(estimator, context)[source]#
Method called at the beginning of the fit method of the estimator.
For auto-propagated callbacks, this method is called only once, before running the fit method of the outermost estimator.
- Parameters:
- estimatorestimator instance
The estimator calling this callback hook.
- context
sklearn.callback.CallbackContextinstance Context of the corresponding task. This is usually the root context of the estimator but it can be an intermediate context if the estimator is a sub-estimator of a meta-estimator.
- teardown(estimator, context)[source]#
Method called after finishing the fit method of the estimator.
For auto-propagated callbacks, this method is called only once, after finishing the fit method of the outermost estimator.
- Parameters:
- estimatorestimator instance
The estimator calling this callback hook.
- context
sklearn.callback.CallbackContextinstance Context of the corresponding task. This is usually the root context of the estimator but it can be an intermediate context if the estimator is a sub-estimator of a meta-estimator.