Using entropy as a criterion
In this exercise, you'll train a classification tree on the Wisconsin Breast Cancer dataset using entropy as an information criterion. You'll do so using all the 30 features in the dataset, which is split into 80% train and 20% test.
X_train as well as the array of labels y_train are available in your workspace.
Latihan ini adalah bagian dari kursus
Machine Learning with Tree-Based Models in Python
Petunjuk latihan
Import
DecisionTreeClassifierfromsklearn.tree.Instantiate a
DecisionTreeClassifierdt_entropywith a maximum depth of 8.Set the information criterion to
'entropy'.Fit
dt_entropyon the training set.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Import DecisionTreeClassifier from sklearn.tree
from ____.____ import ____
# Instantiate dt_entropy, set 'entropy' as the information criterion
dt_entropy = ____(____=____, ____='____', random_state=1)
# Fit dt_entropy to the training set
____.____(____, ____)