When features are continuous (like height, weight, age), Naive Bayes can't use frequency counts. Instead, we model the likelihood P(xi∣y)P(x_i \mid y) using a probability distribution, most commonly a Gaussian (Normal) distribution.


🔸 Gaussian Naive Bayes Assumption

For each feature xix_i, conditioned on class y=cy = c, we assume the data follows a normal distribution:

P(xi∣y=c)=12πσc2⋅exp⁡(−(xi−μc)22σc2)P(x_i \mid y = c) = \frac{1}{\sqrt{2\pi\sigma_c^2}} \cdot \exp\left( -\frac{(x_i - \mu_c)^2}{2\sigma_c^2} \right)

Where:


🔹 Steps to Estimate Probabilities

  1. Split the training data by class y=cy = c
  2. For each feature xix_i:
  3. Use the Gaussian PDF to compute likelihoods P(xi∣y=c)P(x_i \mid y = c) at prediction time

Example

Suppose you have a feature "height" and two classes: Male and Female.

Training data:

Height (cm) Gender
170 Male
180 Male
160 Female
165 Female

Step 1: Compute mean and variance per class