This package is an application of the Naive Bayes Gaussian algorithm that is commonly used to classify objects whose attributes are continuous data.
Please click here to read my brief introduction to Bayesian statistics and a use case of my custom implementation of the Naive Bayes Gaussian algorithm.
This package uses the following libraries.
- Python 3.8
- pandas
- numpy
- plotly
- Pip install the package
pip install NaiveBayesGauss
- Import the model
from NaiveBayes import NaiveBayesGauss
- Instantiate the model
model = NaiveBayesGauss()
- Fit the training data
model.fit(X_train, Y_train)
- Use the fitted model to predict a class using a single observation of attributes
model.predict(X_target.iloc[10], use_normalizer=True)
- Obtain the preceeding prediction's complete prediction probability values
model.predict_prob
- Calculate the model's prediction accuracy on fitted data and plot a confusion matrix
model.predict_accuracy(X_target, Y_target, user_normalizer=True, confusion_matrix=True)
- Calculate the model's prediction accuracy on fitted data and plot the results on a heat map
model.plot_heatmap(X_train, Y_train, attributes['SepalLengthCm', 'PetalLengthCm'], predict_label='Iris-setosa', h=0.1)
Ilya Novak @NovakIlya
- 0.1
- Initial Release
This project is licensed under the MIT License - see the LICENSE.md file for details
- Lectures by Victor Lavrenko were very helpful in understanding the Naive Bayes Gauss algorithm
- The Iris dataset used to validate the model accuracy was obtained from UC Irvine Machine Learning Repository
- The model accuracy was tested against the sklearn implementation
- The code for the heat map was obtained from Arthur Tok