Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Boosting | Boosting Algorithms
Ensemble Learning Techniques with Python

bookChallenge: Boosting

Taak

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.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 4
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

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

Veeg om het menu te tonen

Taak

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 4
single

single

some-alt