本文整理汇总了Python中sklearn.ensemble.AdaBoostClassifier.n_estimators方法的典型用法代码示例。如果您正苦于以下问题:Python AdaBoostClassifier.n_estimators方法的具体用法?Python AdaBoostClassifier.n_estimators怎么用?Python AdaBoostClassifier.n_estimators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.ensemble.AdaBoostClassifier
的用法示例。
在下文中一共展示了AdaBoostClassifier.n_estimators方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: evaluate
# 需要导入模块: from sklearn.ensemble import AdaBoostClassifier [as 别名]
# 或者: from sklearn.ensemble.AdaBoostClassifier import n_estimators [as 别名]
def evaluate(category, clf, datamanager, data=(None, None)):
"""Run evaluation of a classifier, for one category.
If data isn't set explicitly, the test set is
used by default.
"""
log_file = os.path.join(datamanager.PATHS["LOGS"], "evaluation", class_name(clf), category)
log_file = os.path.join(log_file, str(datetime.now()) + ".log")
vcd = VisualConceptDetection(None, datamanager, log_file=log_file)
clf = vcd.load_object("Classifier", category, clf)
vcd.classifier = clf
if (data[0] is None) or (data[1] is None):
return vcd.evaluate_test_set(category)
else:
return vcd.evaluate(X_test=data[0], y_test=data[1])
if __name__ == "__main__":
# classifier = RandomForestClassifier()
classifier = AdaBoostClassifier()
classifier.n_estimators = 2000
classifier.base_estimator.max_depth = 4
# classifier = LinearSVC(C=100)
category = "airplanes"
datamanager = CaltechManager()
evaluate(category, classifier, datamanager)