Package com.namsor.oss.classify.bayes
Interface INaiveBayesClassifier
-
- All Known Implementing Classes:
AbstractNaiveBayesClassifierImpl
,AbstractNaiveBayesClassifierLevelDBImpl
,AbstractNaiveBayesClassifierMapImpl
,AbstractNaiveBayesClassifierRocksDBImpl
,NaiveBayesClassifierLevelDBImpl
,NaiveBayesClassifierLevelDBLaplacedImpl
,NaiveBayesClassifierMapImpl
,NaiveBayesClassifierMapLaplacedImpl
,NaiveBayesClassifierRocksDBImpl
,NaiveBayesClassifierRocksDBLaplacedImpl
public interface INaiveBayesClassifier
Naive Bayes Classifier interface- Author:
- elian carsenat, NamSor SAS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IClassification
classify(Map<String,String> features, boolean explainData)
Predict most probable class, optionally returning the data needed for future explanation.void
dbClose()
Close the classifier (if persistent)void
dbCloseAndDestroy()
Close the classifier (if persistent) and destroy the database.long
dbSize()
Estimate the number of key-values in DBvoid
dumpDb(Writer w)
Dump the current state of the model (can be large)String[]
getCategories()
This classifier has an immutable list of categoriesvoid
learn(String category, Map<String,String> features)
Learn from featuresvoid
learn(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 PersistentClassifierException
Close the classifier (if persistent)- Throws:
PersistentClassifierException
- The persistence error and cause
-
dbCloseAndDestroy
void dbCloseAndDestroy() throws PersistentClassifierException
Close the classifier (if persistent) and destroy the database.- Throws:
PersistentClassifierException
- The persistence error and cause
-
dbSize
long dbSize() throws PersistentClassifierException
Estimate 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
-
-