Challenge: Stacking Model
Tâche
Swipe to start coding
In this challenge, you'll build a Stacking Classifier that combines different base models to improve predictive performance.
Your task:
- Load the Breast Cancer dataset using
load_breast_cancer()fromsklearn.datasets. - Split the dataset into training and testing sets (
test_size=0.3,random_state=42). - Create a stacking ensemble with:
- Base estimators:
- Decision Tree (
DecisionTreeClassifier(max_depth=3, random_state=42)) - Support Vector Classifier (
SVC(probability=True, random_state=42))
- Decision Tree (
- Final estimator:
- Logistic Regression (
LogisticRegression(random_state=42))
- Logistic Regression (
- Base estimators:
- Train your model on the training data.
- Evaluate the model on the test data using accuracy score.
- Print the mode's accuracy.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 4. Chapitre 3
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Génial!
Completion taux amélioré à 7.14
Challenge: Stacking Model
Glissez pour afficher le menu
Tâche
Swipe to start coding
In this challenge, you'll build a Stacking Classifier that combines different base models to improve predictive performance.
Your task:
- Load the Breast Cancer dataset using
load_breast_cancer()fromsklearn.datasets. - Split the dataset into training and testing sets (
test_size=0.3,random_state=42). - Create a stacking ensemble with:
- Base estimators:
- Decision Tree (
DecisionTreeClassifier(max_depth=3, random_state=42)) - Support Vector Classifier (
SVC(probability=True, random_state=42))
- Decision Tree (
- Final estimator:
- Logistic Regression (
LogisticRegression(random_state=42))
- Logistic Regression (
- Base estimators:
- Train your model on the training data.
- Evaluate the model on the test data using accuracy score.
- Print the mode's accuracy.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 4. Chapitre 3
single