Created
February 21, 2021 11:22
-
-
Save Lakshmi-1212/b343c1109ac59d8f7b2026447f43f0f1 to your computer and use it in GitHub Desktop.
Random Forest Classifier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.metrics import r2_score | |
# Create a random forest classifier and fit the training data | |
rfmodel = RandomForestClassifier().fit(X_train, y_train) | |
# Predict the values on the test dataset using sklearn | |
y_pred_rf = rfmodel.predict(X_test) | |
r2_score(y_test, y_pred_rf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment