Scikit-Learn随机森林分类器

from sklearn.ensemble import RandomForestClassifier
data=[[0,0,0],[1,1,1],[2,2,2],[1,1,1],[2,2,2],[3,3,3],[1,1,1],[4,4,4]]
target=[0,1,2,5,2,3,4,6]
rf = RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',
            max_depth=None, max_features='auto', max_leaf_nodes=None,
            min_samples_leaf=1, min_samples_split=2,
            min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=1,
            oob_score=False, random_state=None, verbose=0,
            warm_start=True)
rf.fit(data,target)

print rf.predict_proba([[1,1,2]])

本文链接 http://tec.5lulu.com/code/wyn6hba2a18i57.html

我来评分 :6
0

转载注明:转自5lulu技术库

本站遵循:署名-非商业性使用-禁止演绎 3.0 共享协议

www.5lulu.com