Member-only story

How does a made from scratch Naive Bayes compare to sklearn’s off the shelf version?

Crystal X
4 min readAug 27, 2022

--

Naive Bayes classifiers are a family of probabilistic classifiers based on applying Bayes theorem with strong naive independence assumptions between the features. The model is termed naive because it treats all proposed prediction variables as being independent of one another. Naive Bayes classifiers are highly scalable, requiring a number of parameters linear in the number of variables in a learning problem.

Naive Bayes is a simple technique for constructing classifiers. All Naive Bayes classifiers assume the value of a particular feature is independent of the value of any other feature, given the class variable. For example, a fruit can be considered an apple if it is red, round and 10 cm in diameter. A Naive Bayes classifier considers each of these features to contribute independently to the probability that the fruit is an apple, regardless of any possible correlations between colour, roundness or diameter.

One advantage of Naive Bayes classifiers is they require only a small number of data to estimate the parameters necessary for classification.

The formula for the Naive Bayes classifier can be seen below:-

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

No responses yet