有监督式决策树

    1. from sklearn.ensemble import RandomForestClassifier
    2. from sklearn.datasets import make_classification
    3. X, y = make_classification(n_samples=1000, n_features=4,
    4. n_informative=2, n_redundant=0,
    5. random_state=0, shuffle=False)
    6. clf = RandomForestClassifier(n_estimators=100, max_depth=2,
    7. random_state=0)
    8. clf.fit(X, y)
    9. print(clf.feature_importances_)
    10. print(clf.predict([[0, 0, 0, 0]]))