sklearndf.pipeline.SupervisedLearnerPipelineDF#
- class sklearndf.pipeline.SupervisedLearnerPipelineDF(*, preprocessing=None)[source]#
A data frame enabled pipeline with an optional preprocessing step and a mandatory supervised learner step.
- Bases:
SupervisedLearnerDF
,LearnerPipelineDF
[~T_FinalSupervisedLearnerDF]- Generic types:
~T_FinalSupervisedLearnerDF(bound=
SupervisedLearnerDF
)- Metaclasses:
- Parameters:
preprocessing (
Optional
[TransformerDF
]) – the preprocessing step in the pipeline (default:None
)
Method summary
Make an unfitted clone of this estimator.
Fit this pipeline using the given inputs.
See
sklearn.utils.get_metadata_routing()
Get the parameters for this estimator.
Predict outputs for the given inputs.
Preprocess the given feature values using this pipeline's preprocessing step.
Score this learner using the given inputs and outputs.
See
sklearn.utils.RequestMethod.__get__.<locals>.func()
Set the parameters of this estimator.
See
sklearn.utils.RequestMethod.__get__.<locals>.func()
Render this object as an expression.
Attribute summary
Name assigned to an
Index
or aSeries
with the names of the features used to fit aEstimatorDF
.The pandas column index with the names of the features used to fit this estimator.
The final estimator following the preprocessing step.
The name of the estimator step parameter.
True
if this object is fitted,False
otherwise.The number of features used to fit this estimator.
The number of outputs used to fit this estimator.
The native estimator underlying this estimator.
The name(s) of the output(s) this supervised learner was fitted to.
The preprocessing step.
The name of the preprocessing step parameter.
Definitions
- clone()#
Make an unfitted clone of this estimator.
- Return type:
- Returns:
the unfitted clone
- fit(X, y=None, *, sample_weight=None, **fit_params)#
Fit this pipeline using the given inputs.
- Parameters:
X (
Union
[DataFrame
,Series
]) – input data frame with observations as rows and features as columnsy (
Union
[Series
,DataFrame
,None
]) – an optional series or data frame with one or more outputssample_weight (
Optional
[Series
]) – sample weights for observations, to be passed to the final estimator (optional)fit_params (
Any
) – additional keyword parameters as required by specific estimator implementations
- Return type:
- Returns:
self
- get_metadata_routing()#
See
sklearn.utils.get_metadata_routing()
- get_params(deep=True)#
Get the parameters for this estimator.
- predict(X, **predict_params)#
Predict outputs for the given inputs.
The inputs must have the same features as the inputs used to fit this learner. The features can be provided in any order since they are identified by their column names.
- Parameters:
- Return type:
- Returns:
predictions per observation as a series, or as a data frame in case of multiple outputs
- preprocess(X)#
Preprocess the given feature values using this pipeline’s preprocessing step.
If the pipeline has no preprocessing step, return the input unchanged.
- score(X, y=None, sample_weight=None)[source]#
Score this learner using the given inputs and outputs.
- Parameters:
X (
Union
[Series
,DataFrame
]) – data frame with observations as rows and features as columnsy (
Optional
[Series
]) – a series or data frame with the true outputs per observationsample_weight (
Optional
[Any
]) – optional series of scalar weights, for calculating the resulting score as the weighted mean of the scores for the individual predictions
- Return type:
- Returns:
the score
- set_fit_request()#
See
sklearn.utils.RequestMethod.__get__.<locals>.func()
- set_params(**params)#
Set the parameters of this estimator.
Valid parameter keys can be obtained by calling
get_params()
.- Parameters:
params (
Any
) – the estimator parameters to set- Return type:
- Returns:
self
- set_score_request()#
See
sklearn.utils.RequestMethod.__get__.<locals>.func()
- to_expression()#
Render this object as an expression.
- Return type:
- Returns:
the expression representing this object
- COL_FEATURE = 'feature'#
Name assigned to an
Index
or aSeries
with the names of the features used to fit aEstimatorDF
.
- property feature_names_in_: Index#
The pandas column index with the names of the features used to fit this estimator.
- Raises:
AttributeError – this estimator is not fitted
- abstract property final_estimator: SupervisedLearnerPipelineDF#
The final estimator following the preprocessing step.
- property n_features_in_: int#
The number of features used to fit this estimator.
- Raises:
AttributeError – this estimator is not fitted
- property n_outputs_: int#
The number of outputs used to fit this estimator.
- Raises:
AttributeError – this estimator is not fitted
- property native_estimator: BaseEstimator#
The native estimator underlying this estimator.
This can be another estimator that this estimator delegates to, otherwise the native estimator is
self
.
- property output_names_: list[str]#
The name(s) of the output(s) this supervised learner was fitted to.
- Raises:
sklearn.exceptions.NotFittedError – this estimator is not fitted
- property preprocessing: TransformerDF | None#
The preprocessing step.