Home Knowledge Base Decision Trees

Decision Trees are a supervised machine learning algorithm that makes predictions by learning a series of if-then-else decision rules from training data, organized as a tree structure — where each internal node asks a question about a feature ("Is income > $50K?"), each branch represents an answer, and each leaf node provides the prediction, making them the most interpretable ML model (you can literally visualize and explain every decision), while Random Forests aggregate hundreds of decision trees to eliminate overfitting and achieve production-grade accuracy.

What Is a Decision Tree?

How Trees Learn: Splitting Criteria

CriterionFormulaUsed ForIntuition
Gini Impurity$1 - sum p_i^2$ClassificationHow "mixed" are the labels in this node?
Entropy (Info Gain)$-sum p_i log_2 p_i$ClassificationHow much uncertainty is reduced by this split?
MSE (Mean Squared Error)$frac{1}{n}sum(y_i - ar{y})^2$RegressionHow well does the mean predict all values?

The tree picks the feature and threshold that produces the "purest" child nodes — splitting data so that each branch contains mostly one class.

The Overfitting Problem

A single decision tree will memorize the training data if grown without constraints — achieving 100% training accuracy but poor generalization. Solutions:

TechniqueApproachEffect
Max DepthLimit tree depth (e.g., max_depth=5)Prevents overly specific rules
Min SamplesRequire minimum samples per leafPrevents single-example leaves
PruningRemove branches that don't improve validation accuracySimplifies after training
Random ForestAggregate hundreds of treesThe standard solution

Random Forest

Decision Trees and Random Forests are the most practical ML algorithms for structured/tabular data — providing interpretable predictions through human-readable decision rules in single trees, and production-grade accuracy through Random Forest ensembles that combine hundreds of trees to eliminate overfitting, making them the first algorithm to try for classification and regression on tabular datasets.

decision treeforestensemble

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.