Naïve Bayes Classifier - ML Program

 Naïve Bayes Classifier

Steps:

  1. Understand the business problem
  2. Import the library files
  3. Load the dataset
  4. Data preprocessing
  5. Split the data into train and test
  6. Build the model (Naïve Bayes classifier)
  7. Test the model
  8. Performance Measures
  9. Predict the class label for new data.

1. Understand the business problem

Let’s build a classifier that predicts whether I should play tennis given the forecast. It takes four attributes to describe the forecast; namely, the outlook, the temperature, the humidity, and the presence or absence of wind. Furthermore, the values of the four attributes are qualitative (also known as categorical).

p(C_k |x_1,x_2,…,x_n )= p(C_k ) ∏_(i=1)^n p(x_i |C_k )


2. Import the library files



3. Load the dataset






4. Data preprocessing













5.Split the data into train and test








6. Build the model (Navie Bayes classifier)


7. Test the model



8 .Performance Measures




9. Predict the class label for new data.




Comments

Post a Comment