Challenge: Random Forest
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 4
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Incrível!
Completion taxa melhorada para 7.14
Challenge: Random Forest
Deslize para mostrar o menu
Tarefa
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.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 4
single