StatisticsML Knowledge
Could you guide us through the Naive Bayes algorithm and the basis for setting its classification threshold?
Machine Learning Engineer
Microsoft
Agoda
VMware
Wish
Audible
Answers
Anonymous
4 months ago
Naive Bayes computes the probability of the class given the features:
P(class | features) = P(features | class) * P(class) / P(features).
Navie Bayes assumes that all the features are independent given the class so that the likelihood can be computed easily as a product of all the individual likelihood of features. For each class, it computes a product of all individual features given the class and the prior probability of that class.
The class with the highest probability is chosen as the resulting class.
For a binary classification problem, the default threshold is 0.5, but it can be tuned manually (eg. 0.7) to balance precision and recall given the problem's requirement. For a multi-class problem, the default threshold is 1 / number of classes, and we can use the one-vs-rest technique.
Interview question asked to Machine Learning Engineers interviewing at Nuro, Mozilla, Whatsapp and others: Could you guide us through the Naive Bayes algorithm and the basis for setting its classification threshold?.