Avsnitt 1. Kapitel 4
single
Challenge: Build a Baseline Pipeline
Svep för att visa menyn
Uppgift
Swipe to start coding
You need to create a machine learning pipeline that standardizes input features and fits a classification model.
- Load the Iris dataset.
- Split it into training and test sets.
- Create a pipeline that:
- Uses
StandardScalerto standardize the data; - Uses
RandomForestClassifieras the model.
- Uses
- Fit the pipeline on the training data.
- Predict on the test data.
- Calculate accuracy using
accuracy_scoreand assign it to the variableaccuracy.
Make sure to print the value of accuracy at the end.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 4
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal