📜  导入 RandomForestClassifier - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:48.254000             🧑  作者: Mango

代码示例3
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]]))