Challenge: Random Forest
Tehtävä
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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 4
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Mahtavaa!
Completion arvosana parantunut arvoon 7.14
Challenge: Random Forest
Pyyhkäise näyttääksesi valikon
Tehtävä
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.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 2. Luku 4
single