Package smile.classification
Enum Class DiscreteNaiveBayes.Model
- All Implemented Interfaces:
Serializable
,Comparable<DiscreteNaiveBayes.Model>
,Constable
- Enclosing class:
DiscreteNaiveBayes
The generation models of naive Bayes classifier.
For document classification in NLP, there are two different ways we can set
up a naive Bayes classifier: multinomial model and Bernoulli model. The
multinomial model generates one term from the vocabulary in each position
of the document. The multivariate Bernoulli model or Bernoulli model
generates an indicator for each term of the vocabulary, either indicating
presence of the term in the document or indicating absence.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionThe document Bernoulli model generates an indicator for each term of the vocabulary, either indicating presence of the term in the document or indicating absence.Complement Naive Bayes.The document multinomial model generates one term from the vocabulary in each position of the document.The document Polya Urn model is similar to MULTINOMIAL but different in the conditional probability update during learning.Transformed Weight-normalized Complement Naive Bayes.Weight-normalized Complement Naive Bayes. -
Method Summary
Modifier and TypeMethodDescriptionstatic DiscreteNaiveBayes.Model
Returns the enum constant of this class with the specified name.static DiscreteNaiveBayes.Model[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MULTINOMIAL
The document multinomial model generates one term from the vocabulary in each position of the document. -
BERNOULLI
The document Bernoulli model generates an indicator for each term of the vocabulary, either indicating presence of the term in the document or indicating absence. -
POLYAURN
The document Polya Urn model is similar to MULTINOMIAL but different in the conditional probability update during learning. It simply adds twice for what is seen in training data instead of one time. -
CNB
Complement Naive Bayes. To deal with skewed training data, CNB estimates parameters of a class c using data from all classes except c. CNB's estimates may be more effective because each uses a more even amount of training data per class, which will lessen the bias in the weight estimates. -
WCNB
Weight-normalized Complement Naive Bayes. In practice, it is often the case that weights tend to lean toward one class or the other. When the magnitude of Naive Bayes' weight vector is larger in one class than the others, the larger magnitude class may be preferred. To correct for the fact that some classes have greater dependencies, WCNB normalizes the weight vectors. -
TWCNB
Transformed Weight-normalized Complement Naive Bayes. Before feeding into WCNB, TWCNB transforms term frequencies including TF transform, IDF transform, and length normalization. Because of IDF, TWCNB supports only batch mode.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-