误差复盘
原能力
按事件类型、期限和证据质量整理误报、漏报及方向误差。(细化版 p.4–5)
首选项目
scikit-learn(BSD-3-Clause)。 scikit-learn
匹配范围
误差指标和分组聚合出误报、漏报及方向错误。
源码
scikit-learn · def confusion_matrix(
sklearn/metrics/_classification.py · 443–456 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def confusion_matrix(
y_true, y_pred, *, labels=None, sample_weight=None, normalize=None
):
"""Compute confusion matrix to evaluate the accuracy of a classification.
By definition a confusion matrix :math:`C` is such that :math:`C_{i, j}`
is equal to the number of observations known to be in group :math:`i` and
predicted to be in group :math:`j`.
Thus in binary classification, the count of true negatives is
:math:`C_{0,0}`, false negatives is :math:`C_{1,0}`, true positives is
:math:`C_{1,1}` and false positives is :math:`C_{0,1}`.
Read more in the :ref:`User Guide <confusion_matrix>`.
- # SPDX-License-Identifier: BSD-3-Clause
DuckDB · SinkResultType PhysicalHashAggregate::Sink(
src/execution/operator/aggregate/physical_hash_aggregate.cpp · 396–409 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
SinkResultType PhysicalHashAggregate::Sink(ExecutionContext &context, DataChunk &chunk,
OperatorSinkInput &input) const {
auto &local_state = input.local_state.Cast<HashAggregateLocalSinkState>();
auto &global_state = input.global_state.Cast<HashAggregateGlobalSinkState>();
if (distinct_collection_info) {
SinkDistinct(context, chunk, input);
}
if (CanSkipRegularSink()) {
return SinkResultType::NEED_MORE_INPUT;
}
DataChunk &aggregate_input_chunk = local_state.aggregate_input_chunk;
接口用法示意
confusion_matrix(y_true, y_pred, labels=approved_labels)
实现与验收要点
业务标签、未到期样本、期限和证据质量分组口径。