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

Before Change


    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:

After Change


def ErrorRateAt95Recall(labels, scores):
    distances = 1.0 / (scores + 1e-8)
    recall_point = 0.95
    labels = labels[np.argsort(distances)]
    // Sliding threshold: get first index where recall >= recall_point. 
    // 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). 
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: WZBSocialScienceCenter/tmtoolkit
Commit Name: 8c8417497aff9741449d9bd3681cad6aea06283a
Time: 2019-06-19
Author: markus.konrad@wzb.eu
File Name: tmtoolkit/preprocess/_tmpreproc.py
Class Name: TMPreproc
Method Name: get_dtm


Project Name: scipy/scipy
Commit Name: fc8c9693b2505b48b1e3dc7c2e477e757d42e549
Time: 2015-04-11
Author: pav@iki.fi
File Name: scipy/sparse/linalg/_onenormest.py
Class Name:
Method Name: _algorithm_2_2