Criterion के रूप में entropy का उपयोग
इस अभ्यास में, आप Wisconsin Breast Cancer डेटासेट पर entropy को information criterion मानकर एक classification tree ट्रेन करेंगे. आप डेटासेट के सभी 30 फीचर्स का उपयोग करेंगे. डेटासेट 80% train और 20% test में विभाजित है.
X_train और लेबल्स की array y_train आपके workspace में उपलब्ध हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Tree-Based Models के साथ Machine Learning
अभ्यास निर्देश
sklearn.treeसेDecisionTreeClassifierइम्पोर्ट करें.अधिकतम गहराई 8 के साथ
DecisionTreeClassifierकाdt_entropyइंस्टैंस बनाएँ.information criterion को
'entropy'पर सेट करें.प्रशिक्षण सेट पर
dt_entropyको fit करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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
____.____(____, ____)