MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / calc_threshold

Function calc_threshold

DeepSpeedExample/tasks/ensemble_classifier.py:48–57  ·  view source on GitHub ↗
(p, l)

Source from the content-addressed store, hash-verified

46
47
48def calc_threshold(p, l):
49 trials = [(i) * (1. / 100.) for i in range(100)]
50 best_acc = float('-inf')
51 best_thresh = 0
52 for t in trials:
53 acc = ((apply_threshold(p, t).argmax(-1) == l).astype(float)).mean()
54 if acc > best_acc:
55 best_acc = acc
56 best_thresh = t
57 return best_thresh
58
59
60def apply_threshold(preds, t):

Callers 1

get_thresholdFunction · 0.85

Calls 2

apply_thresholdFunction · 0.85
meanMethod · 0.80

Tested by

no test coverage detected