Define the bagging classifier
In the following exercises you'll work with the Indian Liver Patient dataset from the UCI machine learning repository. Your task is to predict whether a patient suffers from a liver disease using 10 features including Albumin, age and gender. You'll do so using a Bagging Classifier.
This exercise is part of the course
Machine Learning with Tree-Based Models in Python
Exercise instructions
Import
DecisionTreeClassifier
fromsklearn.tree
andBaggingClassifier
fromsklearn.ensemble
.Instantiate a
DecisionTreeClassifier
calleddt
.Instantiate a
BaggingClassifier
calledbc
consisting of 50 trees.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import DecisionTreeClassifier
____
# Import BaggingClassifier
____
# Instantiate dt
dt = ____(random_state=1)
# Instantiate bc
bc = ____(base_estimator=____, n_estimators=____, random_state=1)