Naive Bayes Classifier
A simpler Bayesian Classifier which assumes independent attributes / classes which is why we can write Assuming boolean variables (which we can always achieve via Binning and One-Hot-Encoding), we have the following parameters in the CPTs
We can then do a prediction with The cool thing is, that there are only parameters and there is no search required. Naive Bayes models perform great, even when the data is noisy.
Calculation of Probabilities
If attribute is categorical: is the number of tuples in class having value divided by the number of tuples of the class .
If attribute is continous: Usually computed based on Normal Distribution with
Pros
- easy to implement
- but still good results
Cons
- assumption leads to loss of Accuracy
- as there will always be some kind of dependency amongst variables
Implementation
Use this function to test whether datapoint is more likely for class 1 vs. class 0 by estimating loc and scale from the data for the respective classes.
scipy.stats.norm.pdf(value, loc, scale)