A custom implementation of the Naive Bayes Gaussian algorithm
Project description
A Custom Implementation of the Naive Bayes Gaussian Algorithm
Description
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.
Dependencies
This package uses the following libraries.
- Python 3.8
- pandas
- numpy
- plotly
Installing and Executing program
- 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)
Authors
Ilya Novak @NovakIlya
Version History
- 0.1
- Initial Release
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
NaiveBayesGauss-0.0.1.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file NaiveBayesGauss-0.0.1.tar.gz
.
File metadata
- Download URL: NaiveBayesGauss-0.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5c6d5ab77d2fb21232a274847d80f08294f62d4530bde188e481bb04f8f681d |
|
MD5 | 971680788d12c163c77dfd4cd0bfc48d |
|
BLAKE2b-256 | 15272265e7fe04295f065856293e3816dafa11bb70dc333afa6fcea91659e0bf |
File details
Details for the file NaiveBayesGauss-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: NaiveBayesGauss-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a83b97236d927ef1b1cfc1b1035fbb7488b5795b61f27cbde0def57f35d5792d |
|
MD5 | f982847483ca4607759fe272436a0f88 |
|
BLAKE2b-256 | e4953603d413aa380fe8787d32175b3292acdf96e1e70d933ad54fc5347e4551 |