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 categoriesStringgetClassifierName()voidlearn(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:INaiveBayesClassifierThis classifier has an immutable list of categories- Specified by:
getCategoriesin interfaceINaiveBayesClassifier- Returns:
- the categories
-
learn
public void learn(String category, Map<String,String> features) throws ClassifyException
Description copied from interface:INaiveBayesClassifierLearn from features- Specified by:
learnin interfaceINaiveBayesClassifier- Parameters:
category- The categoryfeatures- The features- Throws:
ClassifyException- The classification error and cause
-
likelihoodsToProbas
protected IClassProbability[] likelihoodsToProbas(double[] likelyhood, double likelyhoodTot)
-
-