public class KLDClassifier extends Object implements TextClassifier<Integer>, TextFeaturesExtractor, Serializable
| Constructor and Description |
|---|
KLDClassifier() |
KLDClassifier(int nbClasses) |
KLDClassifier(int nbClasses,
int maxWordsPerClass) |
KLDClassifier(int nbClasses,
int maxWordsPerClass,
double thresholdFactor,
boolean normalize) |
| Modifier and Type | Method and Description |
|---|---|
protected double |
caculateBeta(Vocabulary documentVocabulary) |
protected double |
calculateGamma(int classIndex) |
Integer |
classify(List<String> documentWords) |
double[] |
distance(List<String> documentWords) |
protected Double |
distance(Vocabulary documentVocabulary,
int classIndex,
double beta) |
protected double |
estimateEpsilon() |
double[] |
extractFeatures(List<String> documentWords) |
protected double |
getEpsilon() |
protected double |
getGamma(int classIndex) |
void |
update(Integer classIndex,
List<String> documentWords) |
protected Double |
wordProbabilityInCategory(String word,
int classIndex) |
protected Double |
wordProbabilityInDocument(String word,
Vocabulary documentVocabulary,
double beta) |
public KLDClassifier()
public KLDClassifier(int nbClasses)
public KLDClassifier(int nbClasses,
int maxWordsPerClass)
public KLDClassifier(int nbClasses,
int maxWordsPerClass,
double thresholdFactor,
boolean normalize)
public double[] extractFeatures(List<String> documentWords)
extractFeatures in interface TextFeaturesExtractorpublic void update(Integer classIndex, List<String> documentWords)
update in interface TextClassifier<Integer>public Integer classify(List<String> documentWords)
classify in interface TextClassifier<Integer>protected Double distance(Vocabulary documentVocabulary, int classIndex, double beta)
protected Double wordProbabilityInDocument(String word, Vocabulary documentVocabulary, double beta)
protected double getEpsilon()
protected double estimateEpsilon()
protected double getGamma(int classIndex)
protected double calculateGamma(int classIndex)
protected double caculateBeta(Vocabulary documentVocabulary)
Copyright © 2013. All rights reserved.