Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Random Forest | Bagging and Random Forests
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Ensemble Learning Techniques with Python

bookChallenge: Random Forest

Tehtävä

Swipe to start coding

Train and evaluate a Random Forest Classifier on the Iris dataset. Your task is to:

  1. Load the dataset using sklearn.datasets.load_iris().
  2. Split the data into training and testing sets (test_size=0.3, random_state=42).
  3. Train a RandomForestClassifier with:
    • n_estimators=100,
    • max_depth=4,
    • random_state=42.
  4. Predict labels on the test set.
  5. Compute and print the accuracy score of your model.
  6. Store the trained model in a variable named rf_model and predictions in y_pred.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 4
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

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?

close

bookChallenge: 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:

  1. Load the dataset using sklearn.datasets.load_iris().
  2. Split the data into training and testing sets (test_size=0.3, random_state=42).
  3. Train a RandomForestClassifier with:
    • n_estimators=100,
    • max_depth=4,
    • random_state=42.
  4. Predict labels on the test set.
  5. Compute and print the accuracy score of your model.
  6. Store the trained model in a variable named rf_model and predictions in y_pred.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 4
single

single

some-alt