(preds, t)
| 58 | |
| 59 | |
| 60 | def 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 | |
| 69 | def threshold_predictions(all_predictions, threshold): |
no test coverage detected