Challenge: Random Forest
Task
Swipe to start coding
Train and evaluate a Random Forest Classifier on the Iris dataset. Your task is to:
- Load the dataset using
sklearn.datasets.load_iris(). - Split the data into training and testing sets (
test_size=0.3,random_state=42). - Train a RandomForestClassifier with:
n_estimators=100,max_depth=4,random_state=42.
- Predict labels on the test set.
- Compute and print the accuracy score of your model.
- Store the trained model in a variable named
rf_modeland predictions iny_pred.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 7.14
Challenge: Random Forest
Swipe to show menu
Task
Swipe to start coding
Train and evaluate a Random Forest Classifier on the Iris dataset. Your task is to:
- Load the dataset using
sklearn.datasets.load_iris(). - Split the data into training and testing sets (
test_size=0.3,random_state=42). - Train a RandomForestClassifier with:
n_estimators=100,max_depth=4,random_state=42.
- Predict labels on the test set.
- Compute and print the accuracy score of your model.
- Store the trained model in a variable named
rf_modeland predictions iny_pred.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 4
single