Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Boosting | Boosting Algorithms
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Ensemble Learning Techniques with Python

bookChallenge: Boosting

Uppgift

Swipe to start coding

Your task is to train and evaluate two boosting models — AdaBoost and Gradient Boosting — on the Breast Cancer dataset.

Follow these steps:

  1. Load the dataset using load_breast_cancer() from sklearn.datasets.
  2. Split the data into training and testing sets (test_size=0.3, random_state=42).
  3. Train:
    • An AdaBoostClassifier with:
      • base_estimator=DecisionTreeClassifier(max_depth=1)
      • n_estimators=50, learning_rate=0.8
    • A GradientBoostingClassifier with:
      • n_estimators=100, learning_rate=0.1, max_depth=3.
  4. Evaluate both models on the test data using accuracy_score.
  5. Print both accuracies.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 4
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

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

Svep för att visa menyn

Uppgift

Swipe to start coding

Your task is to train and evaluate two boosting models — AdaBoost and Gradient Boosting — on the Breast Cancer dataset.

Follow these steps:

  1. Load the dataset using load_breast_cancer() from sklearn.datasets.
  2. Split the data into training and testing sets (test_size=0.3, random_state=42).
  3. Train:
    • An AdaBoostClassifier with:
      • base_estimator=DecisionTreeClassifier(max_depth=1)
      • n_estimators=50, learning_rate=0.8
    • A GradientBoostingClassifier with:
      • n_estimators=100, learning_rate=0.1, max_depth=3.
  4. Evaluate both models on the test data using accuracy_score.
  5. Print both accuracies.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 4
single

single

some-alt