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

Function apply_threshold

DeepSpeedExample/tasks/ensemble_classifier.py:60–66  ·  view source on GitHub ↗
(preds, t)

Source from the content-addressed store, hash-verified

58
59
60def apply_threshold(preds, t):
61 assert (np.allclose(preds.sum(-1), np.ones(preds.shape[0])))
62 prob = preds[:, -1]
63 thresholded = (prob >= t).astype(int)
64 preds = np.zeros_like(preds)
65 preds[np.arange(len(thresholded)), thresholded.reshape(-1)] = 1
66 return preds
67
68
69def threshold_predictions(all_predictions, threshold):

Callers 2

calc_thresholdFunction · 0.85
threshold_predictionsFunction · 0.85

Calls 1

reshapeMethod · 0.45

Tested by

no test coverage detected