Class NBClassifier
java.lang.Object
edu.msu.cme.rdp.classifier.train.validation.NBClassifier
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNBClassifier
(TreeFactory f, int[] wordList, ArrayList<HierarchyTree> nodes, boolean useSeed, int min_bootstrap_words) -
Method Summary
Modifier and TypeMethodDescriptionfor a array of subclasses, gets the probabilities of each subclass, returns the classification whose subclass has the highest probability.This method random select certain number of words and calculate the probability This can only be called after the assignClass() filled the querySeq_wordProbArr matrix
-
Field Details
-
MIN_BOOTSTRSP_WORDS
public static final int MIN_BOOTSTRSP_WORDS- See Also:
-
seed
public static final long seed- See Also:
-
-
Constructor Details
-
NBClassifier
public NBClassifier(TreeFactory f, int[] wordList, ArrayList<HierarchyTree> nodes, boolean useSeed, int min_bootstrap_words) throws IOException - Throws:
IOException
-
-
Method Details
-
assignClass
for a array of subclasses, gets the probabilities of each subclass, returns the classification whose subclass has the highest probability. formula: prob = sum( log(p (wi|c) ) ) i = 1 to n for n words denominator = log ( sum( exp (prob)j ) ) for j = 1 to m for m classes final log posterior prob = prob + p(c) - denominator -
assignClassRandomsample
This method random select certain number of words and calculate the probability This can only be called after the assignClass() filled the querySeq_wordProbArr matrix- Returns:
- the classification whose subclass has the highest probability.
-