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不改動

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