edu.msu.cme.rdp.classifier.train.validation

## Class NBClassifier

- java.lang.Object
- - edu.msu.cme.rdp.classifier.train.validation.NBClassifier

    public class NBClassifier
    extends java.lang.Object

### Field Summary

Fields
`static int` `MIN_BOOTSTRSP_WORDS`
`static long` `seed`

### Constructor Summary

Constructors
Constructor and Description
`NBClassifier(TreeFactory f, int[] wordList, java.util.ArrayList<HierarchyTree> nodes, boolean useSeed, int min_bootstrap_words)`

### Method Summary

Methods
`ValidationClassificationResult` `assignClass()` for a array of subclasses, gets the probabilities of each subclass, returns the classification whose subclass has the highest probability.
`ValidationClassificationResult` `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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MIN_BOOTSTRSP_WORDS

    public static final int MIN_BOOTSTRSP_WORDS

See Also:
  Constant Field Values

#### seed

    public static final long seed

See Also:
  Constant Field Values

### Constructor Detail

#### NBClassifier

    public NBClassifier(TreeFactory f,
                int[] wordList,
                java.util.ArrayList<HierarchyTree> nodes,
                boolean useSeed,
                int min_bootstrap_words)
                 throws java.io.IOException

Throws:
  `java.io.IOException`

### Method Detail

#### assignClass

    public ValidationClassificationResult 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

    public ValidationClassificationResult 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.