Random forest Algorothm

Random forests are basically multiple decision trees put together. This is also known as bagging

To create a Random Forest predictive model, the below steps are followed.

1)Take some random rows from the data, let’s say 80% of all the rows randomly selected.
2) Hence every time selecting some different set of rows.
Take some random columns from the above data, let’s say 50% of all the columns randomly selected.
3)Hence every time selecting some different set of columns.
Create a decision tree using the above data.
4)Repeat steps 1 to 3 for n number of times (Number of trees). n could be any number like 10 or 50 or 500 etc. (This is known as bagging)
5)Combine the predictions from each of the trees to get a final answer.
In the case of Regression, the final answer is the average of predictions made by all trees.

In the case of Classification, the final answer is the mode(majority vote) of predictions made by all trees.

These steps ensure that every possible predictor gets a fair chance in the process.

Because we limit the columns used for each tree.

Also, there is very less bias in the model because we select some different set of random rows for each tree.

 

Leave a Reply

Your email address will not be published. Required fields are marked *