Skip to content

Instantly share code, notes, and snippets.

@omarsar
Created October 15, 2018 09:03
Show Gist options
  • Save omarsar/6398e00182de76dc0127dfe04a398dc4 to your computer and use it in GitHub Desktop.
Save omarsar/6398e00182de76dc0127dfe04a398dc4 to your computer and use it in GitHub Desktop.
def threshold_predictions(predictions, thr=0.999):
thresholded_preds = predictions[:]
low_values_indices = thresholded_preds < thr
thresholded_preds[low_values_indices] = 0
low_values_indices = thresholded_preds >= thr
thresholded_preds[low_values_indices] = 1
return thresholded_preds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment