naive_bayes Module

Naive Bayes classification algorithm.

@author: drusk

class pml.supervised.naive_bayes.NaiveBayes(training_set)[source]

Naive Bayes classifier.

This algorithm classifies samples using probabilities calculated based on applying Bayes’ theorem.

The algorithm is said to be naive because it assumes all features are independent of each other. While not generally true, the approach is still quite effective and allows the training set to be much smaller.

__init__(training_set)[source]

Constructs a new NaiveBayes classifier.

Args:
training_set: model.DataSet
The data used to train the classifier.
get_classification_probabilities(sample)[source]

Determines the probability that a sample belongs to each class that was seen in the training set.

Args:
sample: dict or pandas.Series
The sample or observation to be classified.
Returns:
probabilities: dict
A dictionary of classifications and their probabilities.

Project Versions

Previous topic

model Module

Next topic

pandas_util Module

This Page