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

Before Change


    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

After Change


    // This is the index where the number of elements with label==1 below the threshold reaches a fraction of 
    // "recall_point" of the total number of elements with label==1. 
    // (np.argmax returns the first occurrence of a "1" in a bool array). 
    threshold_index = np.argmax(np.cumsum(labels) >= recall_point * np.sum(labels)) 

    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
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

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: Scitator/catalyst
Commit Name: f4beaac559e00a3676d942dc7e8fea69efc01cfe
Time: 2020-11-30
Author: raveforlive@gmail.com
File Name: catalyst/metrics/hitrate.py
Class Name:
Method Name: hitrate


Project Name: nilmtk/nilmtk
Commit Name: f74a4a251d395b3e175f99845b01ece0e50a79c3
Time: 2014-08-24
Author: nipunreddevil@gmail.com
File Name: nilmtk/metergroup.py
Class Name: MeterGroup
Method Name: select_top_k