Decision Tree Algorithm
Decision Tree Algorithm
3. Working Principle
9. Conclusion
What is a Decision Tree
A supervised machine learning algorithm used for both classification and
regression tasks.
Introduction to Decision Trees
Characteristics of DT
Non Linear
Non Parametric (No assump. / learning parametrs)
Low bias and high variance model
Prone to overfitting
Acts as a basic feature selection algorithm
Anatomy of a Decision Tree
Root Node
The starting point that represents the entire dataset.
Splits into two or more branches.
Decision Nodes
Intermediate nodes where data is split based on feature values.
Represents the feature or question that splits the data.
Leaf Nodes
End nodes that represent the final decision or output.
No further splitting occurs.
Splitting Criteria:
Decision Trees split data based on criteria like Gini Index, Information Gain, or
Mean Squared Error (for regression).
Gini Impurity:
Measures the likelihood of an incorrect classification of a random instance.
Working Principle
Disadvantages
Prone to overfitting, especially with deep trees.
Can be biased towards dominant classes in an imbalanced dataset.
Small changes in data can lead to large changes in the tree structure.
Hyperparameters are settings / configurations that control the behavior of a machine learning model
and the learning process.
Hyperparameters & Tuning
They influence how the model learns and generalizes to new data.
1. Criterion: The function to measure the quality of a split (e.g., Gini, Entropy, MSE, MAE).
5. max_features: The number of features to consider when looking for the best split.
Tuning Techniques
Grid Search
Random Search
Cross-validation
Overfitting :
Decision Trees are prone to overfitting, especially when the tree is too deep. They may
capture noise in the training data, leading to poor generalization to new data.
Overfitting and solutions
Techniques like pruning (reducing the size of the tree) or setting a maximum depth
limit are used to mitigate overfitting.
Pruning Methods:
Pre-pruning: Limit tree growth by `setting conditions like maximum depth or minimum
samples per leaf.
Post-pruning: Reduce the size of the tree after it has been fully grown by removing
branches that have little importance.
Cross-Validation:
Helps in selecting the right model complexity by splitting the dataset into training and
validation sets.
Extensions of Decision Trees Random Forest (Bagging):
An ensemble method that builds multiple decision trees and merges them together for
a more accurate and stable prediction.
Builds multiple independent trees and averages their predictions, focusing on reducing
variance.
XGBoost (Boosting):
Decision Trees are a versatile and powerful tool for both classification and regression.
Understanding the tree's structure and tuning it properly is key to preventing overfitting
and improving model performance.
Next Steps:
Conclusion
`
Learn about ensemble methods like Random Forest and Gradient Boosting.
Books :
engineering+%2Cstripbooks%2C189&sr=1-4
Course :
https://www.coursera.org/specializations/machine-learning#courses
Backup Slide Tree Splitting Architecture
`
Backup Slide Tree Boundary Building