Challenge: Random Forest
Tâche
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
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 4
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Génial!
Completion taux amélioré à 7.14
Challenge: Random Forest
Glissez pour afficher le menu
Tâche
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
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 4
single