Udacity机器学习入门笔记——自选算法 随机森林

自选三个算法之一:

随机森林参数调整学习(Google自带翻译ε=(´ο`*))))

http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html

在ud120-projects\choose_your_own\your_algorithm.py中添加以下代码

from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier(bootstrap=True, class_weight=None, criterion='entropy',
            max_depth=8, max_features='sqrt', max_leaf_nodes=20,
            min_impurity_decrease=0.0, min_impurity_split=None,
            min_samples_leaf=10, min_samples_split=2,
            min_weight_fraction_leaf=0.0, n_estimators=5, n_jobs=1,
            oob_score=False, random_state=0, verbose=0, warm_start=False)
clf = clf.fit(features_train,labels_train)
print clf.score(features_test,labels_test)

通过调整参数最后准确率在0.94,class_vis.py和prep_terrain_data.py不改动

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章