Package com.namsor.oss.classify.bayes
Class AbstractNaiveBayesClassifierImpl
- java.lang.Object
-
- com.namsor.oss.classify.bayes.AbstractNaiveBayesImpl
-
- com.namsor.oss.classify.bayes.AbstractNaiveBayesClassifierImpl
-
- All Implemented Interfaces:
INaiveBayesClassifier
- Direct Known Subclasses:
AbstractNaiveBayesClassifierLevelDBImpl
,AbstractNaiveBayesClassifierMapImpl
,AbstractNaiveBayesClassifierRocksDBImpl
public abstract class AbstractNaiveBayesClassifierImpl extends AbstractNaiveBayesImpl implements INaiveBayesClassifier
A simple, scalable Naive Bayes Classifier, based on a key-value store (in memory, or disk-based)- Author:
- elian carsenat, NamSor SAS
-
-
Field Summary
Fields Modifier and Type Field Description protected Comparator<IClassProbability>
orderByProba
-
Constructor Summary
Constructors Constructor Description AbstractNaiveBayesClassifierImpl(String classifierName, String[] categories)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getCategories()
This classifier has an immutable list of categoriesString
getClassifierName()
void
learn(String category, Map<String,String> features)
Learn from featuresprotected IClassProbability[]
likelihoodsToProbas(double[] likelyhood, double likelyhoodTot)
-
Methods inherited from class com.namsor.oss.classify.bayes.AbstractNaiveBayesImpl
pathCategory, pathCategoryFeatureKey, pathCategoryFeatureKeyValue, pathFeatureKey, pathFeatureKeyCountValueTypes, pathFeatureKeyValue, pathGlobal, pathGlobalCountCategories
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.namsor.oss.classify.bayes.INaiveBayesClassifier
classify, dbClose, dbCloseAndDestroy, dbSize, dumpDb, learn
-
-
-
-
Field Detail
-
orderByProba
protected final Comparator<IClassProbability> orderByProba
-
-
Method Detail
-
getClassifierName
public String getClassifierName()
- Returns:
- the classifierName
-
getCategories
public String[] getCategories()
Description copied from interface:INaiveBayesClassifier
This classifier has an immutable list of categories- Specified by:
getCategories
in interfaceINaiveBayesClassifier
- Returns:
- the categories
-
learn
public void learn(String category, Map<String,String> features) throws ClassifyException
Description copied from interface:INaiveBayesClassifier
Learn from features- Specified by:
learn
in interfaceINaiveBayesClassifier
- Parameters:
category
- The categoryfeatures
- The features- Throws:
ClassifyException
- The classification error and cause
-
likelihoodsToProbas
protected IClassProbability[] likelihoodsToProbas(double[] likelyhood, double likelyhoodTot)
-
-