Turn a DataOp into a “standard” scikit-learn estimator#

When our DataOp only needs 2 inputs, X and y, we can get a learner that accepts the usual scikit-learn inputs rather than a dictionary like SkrubLearners normally do, by using SkrubLearner.with_sklearn_interface() to obtain the learner wrapped in a XySkrubLearner.

import skrub
from skrub import selectors as s
from sklearn.preprocessing import OrdinalEncoder
from sklearn.ensemble import HistGradientBoostingRegressor

dataset = skrub.datasets.fetch_employee_salaries()

Creating an example DataOp#

We define a DataOp that does transformations similar to the TableVectorizer.

X = skrub.var("X").skb.apply(skrub.Cleaner())
num = X.skb.select(s.numeric()).skb.set_name("num").skb.apply("passthrough")
low_card = (
    X.skb.select(s.string() & s.cardinality_below(30))
    .skb.set_name("low_card")
    .skb.apply(OrdinalEncoder())
)
high_card = (
    X.skb.select(s.string() - s.cardinality_below(30))
    .skb.set_name("high_card")
    .skb.apply(
        skrub.StringEncoder(
            n_components=skrub.choose_int(10, 20, n_steps=3, name="n_components")
        )
    )
)
datetime = (
    X.skb.select(s.any_date()).skb.set_name("datetime").skb.apply(skrub.DatetimeEncoder())
)
feat = num.skb.concat([low_card, high_card, datetime], axis=1)
feat


Creating & using the scikit-learn estimator#

Now we make a learner and ask for the sklearn-like interface. It is used as tv.fit_transform(X) (whereas the default .skb.make_learner() behavior would require tv.fit_transform({'X': X})). On any skrub learner calling SkrubLearner.with_sklearn_interface() returns such an estimator that executes the same DataOp but exposes the scikit-learn (X, y) interface instead of the skrub one (which accepts a dictionary).

tv = feat.skb.make_learner().with_sklearn_interface()
tv
XySkrubLearner(learner=SkrubLearner(data_op=<Concat: 4 tables>))
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.


This means our estimator can be used like any other scikit-learn transformer, for example in a scikit-learn Pipeline.

from sklearn.pipeline import Pipeline
from sklearn.model_selection import cross_validate

pipeline = Pipeline([("tv", tv), ("hgb", HistGradientBoostingRegressor())])
pipeline
Pipeline(steps=[('tv',
                 XySkrubLearner(learner=SkrubLearner(data_op=<Concat: 4 tables>))),
                ('hgb', HistGradientBoostingRegressor())])
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.


cross_validate(
    pipeline, dataset.X, dataset.y, scoring="neg_mean_absolute_percentage_error"
)
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))

{'fit_time': array([1.97353888, 1.78285885, 1.86731505, 2.29740787, 1.78534985]), 'score_time': array([0.26279759, 0.27110457, 0.45016456, 0.27062511, 0.33524227]), 'test_score': array([-0.06755275, -0.06675774, -0.06942341, -0.07288586, -0.06517138])}

It can also be used in a scikit-learn GridSearchCV or RandomizedSearchCV. XySkrubLearner.get_param_grid() prepares for us the parameter grid that we can pass to GridSearchCV from the choices in the data op. If we provide our own grid for the other steps, skrub takes care of combining the 2 grids for us.

from sklearn.model_selection import GridSearchCV
import pandas as pd

hgb_grid = {"hgb__learning_rate": [0.2, 0.5]}

grid_search = GridSearchCV(
    pipeline, tv.get_param_grid(key_prefix="tv__", outer_grid=hgb_grid)
).fit(dataset.X, dataset.y)

pd.DataFrame(grid_search.cv_results_)[
    ["param_hgb__learning_rate", "param_tv__0:n_components", "mean_test_score"]
].sort_values("mean_test_score", ascending=False)
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))
/home/circleci/project/.pixi/envs/doc/lib/python3.13/site-packages/sklearn/pipeline.py:1566: UserWarning: The following keys were passed in the environment but have no corresponding variable (or choice) in the DataOp:
['y'].
This usually indicates a mis-typed variable name.
To avoid this warning, remove the extra keys from the environment
or add {'skrub.ignore_extra_keys': True} to the environment.
You can get all the names used in a DataOp (valid keys in the env) with:
list(data_op.skb.get_vars(all_named_ops=True) | data_op.skb.get_choices(named_only=True))
In a future version of skrub this warning may become an exception.

  res = transformer.fit_transform(X, y, **params.get("fit_transform", {}))

Please enable javascript

The skrub table reports need javascript to display correctly. If you are displaying a report in a Jupyter notebook and you see this message, you may need to re-execute the cell or to trust the notebook (button on the top right or "File > Trust notebook").



Using the estimator in another DataOp#

As our table vectorizer is a normal scikit-learn estimator, it can easily be used with .skb.apply().

pred = (
    skrub.X()
    .skb.apply(tv)
    .skb.set_name("table_vectorizer")
    .skb.apply(HistGradientBoostingRegressor(), y=skrub.y())
)
pred


Total running time of the script: (1 minutes 21.432 seconds)

Estimated memory usage: 557 MB

Gallery generated by Sphinx-Gallery