Resumen
Random Fore
Imagen tomada de: https://www.geeksforgeeks.org/random-forest-regression-in-python/
Acá puedes tomar el código:
#Fitting Random Forest Regression to the dataset
#import the regressor
from sklearn.ensamble import RandomForestRegressor
#create regressor object
regressor = RandomForestRegressor(n-estimators = 100, random_state = 0)
#fit the regressor with x and y data
regressor.fit(x,y)
Random Forest Classifier
Imagen tomada de: https://www.datacamp.com/tutorial/random-forests- classifier-python
Acá puedes tomar el código:
#Import Random Forest Model
from sklearn.ensamble import RandomForestClassifier
#create a Gaussian Classifier
clf = RandomForestClassifier(n_estimators = 100)
#Train the model using the training sets y_pred = clf.predict(x_test)
clf.fit(x_train, y train)
y_predict = clf.predic(x_test)