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
व्यक्तिगत फीचर्स पर if-else सवालों की श्रृंखला.
उद्देश्य: class labels निकालना.
फीचर्स और लेबल्स के बीच non-linear संबंध पकड़ता है.
फीचर स्केलिंग नहीं चाहिए (जैसे: Standardization, ..)


# 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)
# 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
Decision region: feature space का वह भाग जहाँ सभी instances एक ही class label पाते हैं.
Decision boundary: अलग-अलग decision regions को अलग करने वाली surface.


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