Wrap a scikit-learn estimator (orDocumentation Index
Fetch the complete documentation index at: https://docs.cirron.com/llms.txt
Use this file to discover all available pages before exploring further.
Pipeline) with a transparent proxy
that opens scopes around fit, predict, transform,
fit_transform, predict_proba, and score. sklearn has no callback
API, so instrumentation is opt-in via explicit wrapping.
Signature
Parameters
| Name | Type | Purpose |
|---|---|---|
estimator | any | An sklearn estimator or sklearn.pipeline.Pipeline. |
Behavior
The returned object is a thin proxy:fit,predict,transform,fit_transform,predict_proba, andscoreare wrapped. Each opens a named scope around the call.- All other attribute access delegates directly to the underlying
estimator.
hasattr,isinstance, and pickling work normally. - For
Pipeline, each step is wrapped recursively so per-step scopes appear as children of the pipeline’s top-level scope.
Examples
Single estimator
Pipeline
Combined with ci.scope
Version support
Requiresscikit-learn >= 1.3, the floor declared by the
cirron-sdk[sklearn] extra. The proxy works with the classic
estimator API (fit / predict / transform / fit_transform /
predict_proba / score) and with sklearn.pipeline.Pipeline.
The newer set_output API is orthogonal; wrapping does not
interfere with configured output transforms.
Why it’s opt-in
sklearn has no callback or hook API comparable to Keras callbacks or HuggingFace’sTrainerCallback. Auto-wrapping every BaseEstimator
subclass would be invasive and prone to breaking user code. Explicit
ci.wrap(estimator) is the least-surprise approach.
Related
ci.scope
The primitive wrap builds on; use directly for non-sklearn code.
Profiling guide
Narrative walk-through of training instrumentation.