By Aisha Javed .
Unfolding Naive Bayes from Scratch! Take-2
So in my previous blog post of Unfolding Naive Bayes from Scratch! Take-1, I tried to decode the rocket science behind the working of The Naive Bayes (NB) ML algorithm, and after going through it’s algorithmic insights, you too must have realized that it’s quite a painless algorithm. In this blog post, we will walk-through it’s complete step by step pythonic implementation ( using basic python only) and it will be quite evident that how easy it is to code NB from scratch and that NB is not that Naive at classifying !
Who’s the Target Audience? ML Beginners
Since I always wanted to decipher ML for absolute beginners and as it is said that if you can’t explain it, you probably didn't understand it, so yeah this blog post too is especially intended for ML beginners looking for humanistic ML resources for an in depth yet without any gibberish jargon of those creepy Greek mathematical formulas ( honestly that scary looking math never made any sense to me too ! )
Outcome of this Tutorial — A Hands-On Pythonic Implementation of NB
As I just mentioned above, a complete walk-through of NB pythonic implementation
Once you reach the end of this blog post, you will be done completely with 90% of understanding & implementing NB and only 10% will be remaining to master it from application point of view!
Defining The Roadmap…..
Milestone # 1: Data Preprocessing Function
Milestone # 2: Implementation of NaiveBayes Class — Defining Functions for Training & Testing
Milestone # 3: Training NB Model on Training Dataset
Milestone # 4: Testing Using Trained NB Model
Milestone # 5: Proving that the Code for NaiveBayes Class is Absolutely Generic!
Before we begin writing code for Naive Bayes in python, I assume you are familiar with:
- Python Lists
- Numpy & just a tad bit of vectorized code
Let’s Begin the with the Pythonic Implementation !