Package com.namsor.oss.classify.bayes
Interface INaiveBayesClassifier
-
- All Known Implementing Classes:
AbstractNaiveBayesClassifierImpl,AbstractNaiveBayesClassifierLevelDBImpl,AbstractNaiveBayesClassifierMapImpl,AbstractNaiveBayesClassifierRocksDBImpl,NaiveBayesClassifierLevelDBImpl,NaiveBayesClassifierLevelDBLaplacedImpl,NaiveBayesClassifierMapImpl,NaiveBayesClassifierMapLaplacedImpl,NaiveBayesClassifierRocksDBImpl,NaiveBayesClassifierRocksDBLaplacedImpl
public interface INaiveBayesClassifierNaive Bayes Classifier interface- Author:
- elian carsenat, NamSor SAS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IClassificationclassify(Map<String,String> features, boolean explainData)Predict most probable class, optionally returning the data needed for future explanation.voiddbClose()Close the classifier (if persistent)voiddbCloseAndDestroy()Close the classifier (if persistent) and destroy the database.longdbSize()Estimate the number of key-values in DBvoiddumpDb(Writer w)Dump the current state of the model (can be large)String[]getCategories()This classifier has an immutable list of categoriesvoidlearn(String category, Map<String,String> features)Learn from featuresvoidlearn(String category, Map<String,String> features, long weight)Learn from features
-
-
-
Method Detail
-
learn
void learn(String category, Map<String,String> features) throws ClassifyException
Learn from features- Parameters:
category- The categoryfeatures- The features- Throws:
ClassifyException- The classification error and cause
-
learn
void learn(String category, Map<String,String> features, long weight) throws ClassifyException
Learn from features- Parameters:
category- The categoryfeatures- The featuresweight- The weight- Throws:
ClassifyException- The classification error and cause
-
classify
IClassification classify(Map<String,String> features, boolean explainData) throws ClassifyException
Predict most probable class, optionally returning the data needed for future explanation.- Parameters:
features- The featuresexplainData- If should return the data needed for future explanation- Returns:
- The most likely classes with probability and (optionally) the explanation
- Throws:
ClassifyException- The classification error and cause
-
getCategories
String[] getCategories()
This classifier has an immutable list of categories- Returns:
- The classification categories
-
dbClose
void dbClose() throws PersistentClassifierExceptionClose the classifier (if persistent)- Throws:
PersistentClassifierException- The persistence error and cause
-
dbCloseAndDestroy
void dbCloseAndDestroy() throws PersistentClassifierExceptionClose the classifier (if persistent) and destroy the database.- Throws:
PersistentClassifierException- The persistence error and cause
-
dbSize
long dbSize() throws PersistentClassifierExceptionEstimate the number of key-values in DB- Returns:
- The estimate number of key values
- Throws:
PersistentClassifierException- The persistence error and cause
-
dumpDb
void dumpDb(Writer w) throws PersistentClassifierException
Dump the current state of the model (can be large)- Parameters:
w- A writer- Throws:
PersistentClassifierException- The persistence error and cause
-
-