在Python中设置Random Forrest的方法

时间:2019-02-25 11:16:37

标签: python random-forest decision-tree

以下3种方法之间有什么区别(优点,缺点)?具体来说,装袋分类器max_features = 1是做什么的?因为将其设置为小于1的float会导致错误,但应包括树中的随机性。但是,也许这是在基本估算器max_features参数中完成的?是的,装袋分类器的max_features参数有什么作用?

# model 1
clf = DecisionTreeClassifier(criterion='entropy', max_features="auto",
                             class_weight='balanced', min_weight_fraction_leaf=minWLeaf)
clf = BaggingClassifier(base_estimator=clf, n_estimators=n_estimators,
                        max_features=1., max_samples=max_samples,
                        oob_score=True, n_jobs=n_jobs)
# model 2
clf = RandomForestClassifier(n_estimators=n_estimators, class_weight='balanced_subsample', criterion='entropy')
# model 3
clf = RandomForestClassifier(n_estimators=1, class_weight='balanced_subsample', 
                             criterion='entropy', bootstrap=False, oob_score=True)
clf = BaggingClassifier(base_estimator=clf, n_estimators=n_estimators,
                        max_features=1., max_samples=max_samples,
                        oob_score=True, n_jobs=n_jobs)

0 个答案:

没有答案