Created
January 6, 2021 09:45
-
-
Save suhaskv/576736f9545b972ec97814069c0fbfa4 to your computer and use it in GitHub Desktop.
VSB Power Line Blog - Best threshold selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
best_threshold = 0 | |
best_score = 0 | |
thresh_arr = np.linspace(0, 0.99, 100) | |
y_val = y_train | |
for thresh in thresh_arr: | |
preds_train_target = (preds_train_target_proba > thresh).astype(np.int).flatten() | |
score = matthews_corrcoef(y_val, preds_train_target) | |
if score > best_score: | |
best_threshold = thresh | |
best_score = score |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment