Training the Random Forest algorithm
The Random Forest algorithm is an ensemble learning model, meaning it uses an ensemble of decision trees, hence forest in its name.
In this recipe, we will explain how it works and then train a Random Forest model on the California housing dataset.
Getting ready
Ensemble learning is based somehow on the idea of collective intelligence. Let’s do a thought experiment to understand the power of collective intelligence.
Let’s assume we have a bot that randomly answers correctly to any binary question 51% of the time. This would be considered inefficient and unreliable.
But now, let’s also assume we are using not only one but an army of those randomly answering bots and use the majority vote as the final answer. If we have 1,000 of those bots, the majority vote will provide the right answer 75% of the time. If we have 10,000 bots, the majority vote will provide the right answer 97% of the time. This would turn a low...