This is a simple implementation of a Gaussian Naive Classifier in python. Part of the probabilistic classifers [1], can acheive high accuracy on the given classification tasks.
Below the classifier is trained on the iris dataset[3] x
, than random samples are classified with it o
.
- clone the project
- import in your project the
utils/gaussian_naive_classifier.py
- load and format the dataset for traning to have a layout of
Sampple Nr x Labels + Features
- create an instance for "GaussianNaiveBayesClassifier" object
gnb = GaussianNaiveBayesClassifier(labels=labels, label_data_indx=0, feature_data_indx=[1,2,3,4], return_class_label=True)
- train it with your data
gnb.fit_data(data)
- use a data point to predict the class
gnb.predict(sample)
See details of a working example in naive_bayes.ipynb
, uses the iris [3] dataset for classifications.
/Enjoy.