How to set threshold in binary classifier within the model

As binary classifier is classifying based on probability threshold of 0.5, how could I change the threshold to be something else like 0.6 to increase precision?
Is there a way to do this withing the model or it should be after getting the probability. i.e. post training

1 Like

First use model.predict() to extract the class probabilities. For binary classification use a threshold to select the probabilities that will determine class 0 or 1

np.where(y_pred > 0.6, 1,0)

Thank you.