12.08.2021
Random Forest Regression
Random Forest Learning is a version of Ensemble Learning, there are also other version such as gradient boosting. Ensemble Learning is you take multiple algorithms or an algorithm multiple times and you put them together to make something much more powerful than it was.?
Step 1.?
Pick at random K data points from the training dataset.
Step 2.
Build the Decision tree associated to these K data points.
Step 3.
Choose the number of Ntree of trees you want to build and repeat steps 1&2
Step 4.?
For a new data point, make each one of your Ntree trees predict the value of Y to for the data point in question, and assign the new data point the average across all of the predicted Y values.
- Training the Random Forest Regression model on the whole dataset
from sklearn.ensemble import RandomForestRegressor
regressor = RandomForestRegressor(n_estimators = 10, random_state = 0)
regressor.fit(X, y)
-?Predicting a new result
regressor.predict([[6.5]])
|