Answers for "random forest classifier machine learning"

-2

Scikit learn random forest classifier

from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=1000, n_features=4,
                           n_informative=2, n_redundant=0,
                           random_state=0, shuffle=False)
clf = RandomForestClassifier(max_depth=2, random_state=0)
clf.fit(X, y)

print(clf.predict([[0, 0, 0, 0]]))
Posted by: Guest on March-17-2021
0

random forest classifier classification report

# View the classification report for test data and predictions
print(classification_report(y_test, y_pred_test))
Posted by: Guest on August-04-2021

Code answers related to "random forest classifier machine learning"

Python Answers by Framework

Browse Popular Code Answers by Language