Course Content
ML Introduction with scikit-learn
ML Introduction with scikit-learn
Challenge: Creating a Complete ML Pipeline
Now let's create a proper pipeline with the final estimator. As a result, we will get a trained prediction pipeline that can be used for predicting new instances simply by calling the .predict()
method.
To train a predictor (model), you need y
to be encoded. This is done separately from the pipeline we build for X
. Remember that LabelEncoder
is used for encoding the target.
Swipe to show code editor
You have the same penguins dataset. The task is to build a pipeline with KNeighborsClassifier
as a final estimator, train it, and predict values for the X
itself.
- Encode the
y
variable. - Create a pipeline containing
ct
,SimpleImputer
,StandardScaler
, andKNeighborsClassifier
. - Train the
pipe
object using the featuresX
and the targety
.
Thanks for your feedback!
Challenge: Creating a Complete ML Pipeline
Now let's create a proper pipeline with the final estimator. As a result, we will get a trained prediction pipeline that can be used for predicting new instances simply by calling the .predict()
method.
To train a predictor (model), you need y
to be encoded. This is done separately from the pipeline we build for X
. Remember that LabelEncoder
is used for encoding the target.
Swipe to show code editor
You have the same penguins dataset. The task is to build a pipeline with KNeighborsClassifier
as a final estimator, train it, and predict values for the X
itself.
- Encode the
y
variable. - Create a pipeline containing
ct
,SimpleImputer
,StandardScaler
, andKNeighborsClassifier
. - Train the
pipe
object using the featuresX
and the targety
.
Thanks for your feedback!