Reference no: EM133370674
Naive Bayes Classifier
Here we to develop a PYTHON code to implement your own naive Bayes classifier.
You need to implement a naive Bayes classifier from scratch **using the training data of wine datasets train_x and train_y**. The required functions are listed below. You can add more functions as you need. **No library versions of naive bayes classifier are allowed**.
1. train_val_split
**Randomly** split training data into train and val set. 80% of the training data will be the train set and 20% of the training data will be the val set.
2. normalization (data preprocessing)
You should normalize all data for each attribute first.
3. cross_validation_split
**Randomly** split data into 5 folds.
4. predict
Predict the class label for a given x.
5. accurate
Calculate the accuracy percentage of the predictions. Remember to average the results of k folds
6. gaussian_probability
Calculate the Gaussian probability distribution function for the given x
5. class_probability
Calculate the probabilities of predicting each class for a given x using the naive Bayes algorithm. Be aware that we have multiple input variables. And you may want to use the gaussian_probability function here.