【发布时间】:2015-10-16 19:23:09
【问题描述】:
我想看看准确率和召回率如何随阈值而变化(不仅仅是彼此)
model = RandomForestClassifier(500, n_jobs = -1);
model.fit(X_train, y_train);
probas = model.predict_proba(X_test)[:, 1]
precision, recall, thresholds = precision_recall_curve(y_test, probas)
print len(precision)
print len(thresholds)
返回:
283
282
因此,我不能将它们绘制在一起。关于为什么会出现这种情况的任何线索?
【问题讨论】:
-
要将 N 个元素分成 3 个组,您需要 2 个阈值,这就是原因。泛化适用于您需要
n-1决策函数的n箱(在这种情况下为阈值)。
标签: python python-2.7 scikit-learn precision-recall