Doubt in finding the predicted value

in the def prediction function , when at the last step we calculate the argmax(posterior_probabilities) and store it in prediction, then obviously the argmax will contain the maximum value of the posterior probabilites calculated for each of the classes, thereby it would be a decimal value as it is the probability , then how come it return the class 0 or 1, please help…

The argmax function of numpy library returns the index of the maximum value and not the maximum value itself and hence it will contain 0 if probability of zero class is higher other wise it would contain 1 meaning 1 class has higher probability.

Hope this helped :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.