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 start coding
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
. - Use
'most_frequent'
strategy withSimpleInputer
. - Train the
pipe
object using the featuresX
and the targety
.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.13Awesome!
Completion rate improved to 3.13
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 start coding
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
. - Use
'most_frequent'
strategy withSimpleInputer
. - Train the
pipe
object using the featuresX
and the targety
.
Solution
Thanks for your feedback!
single
Awesome!
Completion rate improved to 3.13
Challenge: Creating a Complete ML Pipeline
Swipe to show menu
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 start coding
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
. - Use
'most_frequent'
strategy withSimpleInputer
. - Train the
pipe
object using the featuresX
and the targety
.
Solution
Thanks for your feedback!