क्लासिफिकेशन के लिए Decision-Tree

Python में Tree-Based Models के साथ Machine Learning

Elie Kawerk

Data Scientist

कोर्स अवलोकन

  • अध्याय 1: Classification And Regression Tree (CART)

  • अध्याय 2: Bias-Variance Tradeoff

  • अध्याय 3: Bagging और Random Forests

  • अध्याय 4: Boosting

  • अध्याय 5: Model Tuning

Python में Tree-Based Models के साथ Machine Learning

Classification-tree

  • व्यक्तिगत फीचर्स पर if-else सवालों की श्रृंखला.

  • उद्देश्य: class labels निकालना.

  • फीचर्स और लेबल्स के बीच non-linear संबंध पकड़ता है.

  • फीचर स्केलिंग नहीं चाहिए (जैसे: Standardization, ..)

Python में Tree-Based Models के साथ Machine Learning

2D में Breast Cancer डेटासेट

BC2D

Python में Tree-Based Models के साथ Machine Learning

Decision-tree डायग्राम

CART-rep

Python में Tree-Based Models के साथ Machine Learning

scikit-learn में Classification-tree

# Import DecisionTreeClassifier
from sklearn.tree import DecisionTreeClassifier
# Import train_test_split
from sklearn.model_selection import train_test_split
# Import accuracy_score
from sklearn.metrics import accuracy_score

# Split the dataset into 80% train, 20% test X_train, X_test, y_train, y_test= train_test_split(X, y, test_size=0.2, stratify=y, random_state=1)
# Instantiate dt dt = DecisionTreeClassifier(max_depth=2, random_state=1)
Python में Tree-Based Models के साथ Machine Learning

scikit-learn में Classification-tree

# Fit dt to the training set
dt.fit(X_train,y_train) 

# Predict the test set labels
y_pred = dt.predict(X_test)

# Evaluate the test-set accuracy accuracy_score(y_test, y_pred)
0.90350877192982459
Python में Tree-Based Models के साथ Machine Learning

Decision Regions

Decision region: feature space का वह भाग जहाँ सभी instances एक ही class label पाते हैं.

Decision boundary: अलग-अलग decision regions को अलग करने वाली surface.

DR

Python में Tree-Based Models के साथ Machine Learning

Decision Regions: CART बनाम Linear Model

LRvsDT

Python में Tree-Based Models के साथ Machine Learning

अभ्यास करते हैं!

Python में Tree-Based Models के साथ Machine Learning

Preparing Video For Download...