04cd555be76efc7baced753c751c4257d41eb75d,EvalMetrics.py,,ErrorRateAt95Recall,#Any#Any#,10
Before Change
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
// (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
return float(FP) / float(FP + TN)
"""import operator
def ErrorRateAt95Recall(labels, scores):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 9
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: allenai/allennlp
Commit Name: 8ba58675175e91d306f55380833458acfcb38cdd
Time: 2018-05-10
Author: pradeep.dasigi@gmail.com
File Name: allennlp/models/semantic_parsing/wikitables/wikitables_erm_semantic_parser.py
Class Name: WikiTablesErmSemanticParser
Method Name: _get_state_cost
Project Name: dask/distributed
Commit Name: 383ea0326ae103b5d5e0b62ed9c3cb18510c5b9e
Time: 2021-02-17
Author: jakirkham@gmail.com
File Name: distributed/comm/tcp.py
Class Name: TCP
Method Name: write
Project Name: cornellius-gp/gpytorch
Commit Name: 2bde0e217c491b62dd5e29f8150d4728e7880e8c
Time: 2017-08-18
Author: gpleiss@gmail.com
File Name: gpytorch/__init__.py
Class Name:
Method Name: mvn_kl_divergence