How can we use random forest algorithm for regression problem?

Random forest algorithm for a regression problem

Random forest algorithm


During training, a Random Forest constructs many decision trees and outputs the mean of the classes as the prediction of all the trees. 

Regression problems can also be solved with Random Forests (predict continuous outputs, such as price). Random Forest Regression is a supervised learning approach for regression that employs the ensemble learning method. 

For each input, each decision tree regression predicts a number as an output. The ‘final' result of random forest regression is the average of those predictions. 

We can implement Random Forest Regression using the following method, 

from sklearn.ensemble import RandomForestRegressor 

regressor = RandomForestRegressor(n_estimators = 100, random_state = 0) regressor.fit(x, y) 

So, Random forests can be used for regression analysis and are in fact called Regression Forests. Each leaf contains a distribution for the continuous output variables. 

Post a Comment

Previous Post Next Post