Common
Core APIs
Recipe
Recipe(self, *steps)
Attributes
Name | Description |
---|---|
output_format | The output format to use for transform |
Methods
Name | Description |
---|---|
fit | Fit a recipe. |
fit_transform | Fit and transform in one step. |
get_params | Get parameters for this recipe. |
is_fitted | Check if this recipe has already been fit. |
set_output | Set output type returned by transform . |
set_params | Set the parameters of this recipe. |
to_dask_dataframe | Transform X and return a dask.dataframe.DataFrame . |
to_dask_dmatrix | Transform X and return a xgboost.dask.DMatrix |
to_dmatrix | Transform X and return a xgboost.DMatrix |
to_ibis | Transform X and return an ibis table. |
to_numpy | Transform X and return a numpy.ndarray . |
to_pandas | Transform X and return a pandas.DataFrame . |
to_polars | Transform X and return a polars.DataFrame . |
to_pyarrow | Transform X and return a pyarrow.Table . |
to_pyarrow_batches | Transform X and return a pyarrow.RecordBatchReader . |
transform | Transform the data. |
fit
fit(X, y=None)
Fit a recipe.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | Training data. | required |
y |
column - like | Training targets. | None |
Returns
Type | Description |
---|---|
self | Returns the same instance. |
fit_transform
fit_transform(X, y=None)
Fit and transform in one step.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | Training data. | required |
y |
column - like | Training targets. | None |
Returns
Type | Description |
---|---|
Xt | Transformed training data. |
get_params
get_params(deep=True)
Get parameters for this recipe.
Returns the parameters given in the constructor as well as the steps contained within the steps
of the Recipe
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
deep |
bool | If True, will return the parameters for this recipe and contained steps. | True |
Returns
Type | Description |
---|---|
mapping of string to any | Parameter names mapped to their values. |
Notes
Derived from [1]_.
References
.. [1] https://github.com/scikit-learn/scikit-learn/blob/ee5a1b6/sklearn/utils/metaestimators.py#L30-L50
is_fitted
is_fitted()
Check if this recipe has already been fit.
set_output
set_output(transform=None)
Set output type returned by transform
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
transform |
(‘default’, ‘pandas’) | Configure output of transform and fit_transform . - "default" : Default output format of a transformer - "pandas" : Pandas dataframe - "polars" : Polars dataframe - "pyarrow" : PyArrow table - None : Transform configuration is unchanged |
"default" |
set_params
set_params(**params)
Set the parameters of this recipe.
Valid parameter keys can be listed with get_params()
. Note that you can directly set the parameters of the steps contained in steps
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
**params |
dict | Parameters of this recipe or parameters of steps contained in steps . Parameters of the steps may be set using its name and the parameter name separated by a ’__’. |
{} |
Returns
Type | Description |
---|---|
object | Recipe class instance. |
Notes
Derived from [1]_ and [2]_.
References
.. [1] https://github.com/scikit-learn/scikit-learn/blob/ff1c6f3/sklearn/utils/metaestimators.py#L51-L70 .. [2] https://github.com/scikit-learn/scikit-learn/blob/74016ab/sklearn/base.py#L214-L256
to_dask_dataframe
to_dask_dataframe(X, categories=False)
Transform X and return a dask.dataframe.DataFrame
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
categories |
bool | Whether to return any categorical columns as dask categorical series. If False (the default) these columns will be returned as numeric columns containing only their integral categorical codes. | False |
to_dask_dmatrix
to_dask_dmatrix(X)
Transform X and return a xgboost.dask.DMatrix
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
to_dmatrix
to_dmatrix(X)
Transform X and return a xgboost.DMatrix
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
to_ibis
to_ibis(X)
Transform X and return an ibis table.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
to_numpy
to_numpy(X)
Transform X and return a numpy.ndarray
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
to_pandas
to_pandas(X, categories=False)
Transform X and return a pandas.DataFrame
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
categories |
bool | Whether to return any categorical columns as pandas categorical series. If False (the default) these columns will be returned as numeric columns containing only their integral categorical codes. | False |
to_polars
to_polars(X)
Transform X and return a polars.DataFrame
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
to_pyarrow
to_pyarrow(X, categories=False)
Transform X and return a pyarrow.Table
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
categories |
bool | Whether to return any categorical columns as dictionary-encoded columns. If False (the default) these columns will be returned as numeric columns containing only their integral categorical codes. | False |
to_pyarrow_batches
to_pyarrow_batches(X, categories=False)
Transform X and return a pyarrow.RecordBatchReader
.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | The input data to transform. | required |
categories |
bool | Whether to return any categorical columns as dictionary-encoded columns. If False (the default) these columns will be returned as numeric columns containing only their integral categorical codes. | False |
transform
transform(X)
Transform the data.
Parameters
Name | Type | Description | Default |
---|---|---|---|
X |
table - like | Data to transform. | required |
Returns
Type | Description |
---|---|
Xt | Transformed data. |