Udacity機器學習入門筆記——自選演算法 隨機森林
阿新 • • 發佈:2019-01-09
自選三個演算法之一:
隨機森林引數調整學習(Google自帶翻譯ε=(´ο`*))))
在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不改動