BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Machine Learning with Tree-Based Models in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import DecisionTreeClassifier from sklearn.tree.

  • Instantiate a DecisionTreeClassifier dt_entropy with a maximum depth of 8.

  • Set the information criterion to 'entropy'.

  • Fit dt_entropy on the training set.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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
____.____(____, ____)
Kodu Düzenle ve Çalıştır