Answers for "sklearn random forest score"

8

sklearn random forest

from sklearn.ensemble import RandomForestClassifier


clf = RandomForestClassifier(max_depth=2, random_state=0)

clf.fit(X, y)

print(clf.predict([[0, 0, 0, 0]]))
Posted by: Guest on November-26-2020
0

sklearn random forest feature importance

from sklearn.ensemble import RandomForestClassifier

feature_names = [f'feature {i}' for i in range(X.shape[1])]
forest = RandomForestClassifier(random_state=0)
forest.fit(X_train, y_train)
Posted by: Guest on May-09-2021

Code answers related to "sklearn random forest score"

Python Answers by Framework

Browse Popular Code Answers by Language