04cd555be76efc7baced753c751c4257d41eb75d,EvalMetrics.py,,ErrorRateAt95Recall,#Any#Any#,10

Before Change


def ErrorRateAt95Recall(labels, scores):
    recall_point = 0.95
    // Sort label-score tuples by the score in descending order.
    sorted_scores = zip(labels, scores)
    sorted_scores.sort(key=operator.itemgetter(1), reverse=False)

    // Compute error rate
    n_match = sum(1 for x in sorted_scores if x[0] == 1)
    n_thresh = recall_point * n_match
    tp = 0
    count = 0
    for label, score in sorted_scores:
        count += 1
        if label == 1:
            tp += 1
        if tp >= n_thresh:
            break

    return float(count - tp) / count

After Change



    FP = np.sum(labels[:threshold_index] == 0) // Below threshold (i.e., labelled positive), but should be negative
    TN = np.sum(labels[threshold_index:] == 0) // Above threshold (i.e., labelled negative), and should be negative
    return float(FP) / float(FP + TN)
"""import operator

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: DagnyT/hardnet
Commit Name: 04cd555be76efc7baced753c751c4257d41eb75d
Time: 2017-07-27
Author: ducha.aiki@gmail.com
File Name: EvalMetrics.py
Class Name:
Method Name: ErrorRateAt95Recall


Project Name: azavea/raster-vision
Commit Name: fe8fee4f05e08a6448d46b8f70d960f02ef048b8
Time: 2021-01-08
Author: AdeelH@users.noreply.github.com
File Name: rastervision_pytorch_backend/rastervision/pytorch_backend/pytorch_chip_classification.py
Class Name: PyTorchChipClassification
Method Name: predict


Project Name: facebookresearch/pytext
Commit Name: c6c952ee02843a3c46700e1a4409a2b99fbabe4a
Time: 2019-07-11
Author: shreyd@fb.com
File Name: pytext/metric_reporters/language_model_metric_reporter.py
Class Name: LanguageModelMetricReporter
Method Name: calculate_loss