Decision trees and random forests are data driven methods, which can be used both for classification (called Classification tree) and for prediction (called Regression tree). Trees are wildly spread because it is easy to interpret for non-professionals in Data mining and they provide accurate results. Decision trees algorithm based on separating observations into smaller groups creating smaller splits. These splits create rules, which are used to classify or predict a desirable outcome. For example, IF Income > 500$ and Age < 23 than the observation belongs to class 1.
Here is an example of a decision tree, which helps us to predict approve the loan or not.
There are two major ideas, which help us to construct a tree: Recursive partitioning and Pruning.
Recursive partitioning: Repeatedly split the records into two parts to achieve maximum homogeneity within new parts.
Pruning the tree: Simplify the tree by pruning peripheral branches to avoid overfitting.
Recursive partitioning steps:
1. Pick one of the predictor variable Xi
2.

