T
- The feature class.K
- The category class.public class BayesClassifier<T,K> extends Classifier<T,K>
http://en.wikipedia.org/wiki/Naive_Bayes_classifier
Constructor and Description |
---|
BayesClassifier() |
Modifier and Type | Method and Description |
---|---|
private java.util.SortedSet<Classification<T,K>> |
categoryProbabilities(java.util.Collection<T> features)
Retrieves a sorted
Set of probabilities that the given set
of features is classified as the available categories. |
private float |
categoryProbability(java.util.Collection<T> features,
K category)
Calculates the probability that the features can be classified as the
category given.
|
Classification<T,K> |
classify(java.util.Collection<T> features)
Classifies the given set of features.
|
java.util.Collection<Classification<T,K>> |
classifyDetailed(java.util.Collection<T> features)
Classifies the given set of features.
|
private float |
featuresProbabilityProduct(java.util.Collection<T> features,
K category)
Calculates the product of all feature probabilities: PROD(P(featI|cat)
|
categoryCount, decrementCategory, decrementFeature, featureCount, featureProbability, featureWeighedAverage, featureWeighedAverage, featureWeighedAverage, featureWeighedAverage, getCategories, getCategoriesTotal, getFeatures, getMemoryCapacity, incrementCategory, incrementFeature, learn, learn, reset, setMemoryCapacity
private float featuresProbabilityProduct(java.util.Collection<T> features, K category)
features
- The set of features to use.category
- The category to test for.private float categoryProbability(java.util.Collection<T> features, K category)
features
- The set of features to use.category
- The category to test for.private java.util.SortedSet<Classification<T,K>> categoryProbabilities(java.util.Collection<T> features)
Set
of probabilities that the given set
of features is classified as the available categories.features
- The set of features to use.Set
of category-probability-entries.public Classification<T,K> classify(java.util.Collection<T> features)
classify
in class Classifier<T,K>
features
- The features to classify.public java.util.Collection<Classification<T,K>> classifyDetailed(java.util.Collection<T> features)