Package opennlp.tools.ml.naivebayes

# Class NaiveBayesModel

java.lang.Object
opennlp.tools.ml.model.AbstractModel
opennlp.tools.ml.naivebayes.NaiveBayesModel

All Implemented Interfaces:
  `opennlp.tools.ml.model.MaxentModel`

public class NaiveBayesModel extends opennlp.tools.ml.model.AbstractModel
A `MaxentModel` implementation of the multinomial Naive Bayes classifier model.

See Also:
  - `AbstractModel`
  - `MaxentModel`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NaiveBayesModel(opennlp.tools.ml.model.Context[] params, String[] predLabels, String[] outcomeNames)`
  Initializes a `NaiveBayesModel`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static double[]`
  `eval(int[] context, double[] prior, opennlp.tools.ml.model.EvalParameters model)`
  Evaluates a `NaiveBayesModel`.
  `double[]`
  `eval(String[] context)`
  `double[]`
  `eval(String[] context, double[] probs)`
  `double[]`
  `eval(String[] context, float[] values)`
  `double[]`
  `eval(String[] context, float[] values, double[] outsums)`

  ### Methods inherited from class opennlp.tools.ml.model.AbstractModel

  `equals, getAllOutcomes, getBestOutcome, getDataStructures, getIndex, getModelType, getNumOutcomes, getOutcome, hashCode`

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

  `getClass, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### NaiveBayesModel

    public NaiveBayesModel(opennlp.tools.ml.model.Context[] params, String[] predLabels, String[] outcomeNames)
    Initializes a `NaiveBayesModel`.
    Parameters:
      `params` - The `parameters` to set.
      `predLabels` - The predicted labels.
      `outcomeNames` - The names of the outcomes.

- ## Method Details

  - ### eval

    public double[] eval(String[] context)

  - ### eval

    public double[] eval(String[] context, float[] values)

  - ### eval

    public double[] eval(String[] context, double[] probs)

  - ### eval

    public double[] eval(String[] context, float[] values, double[] outsums)

  - ### eval

    public static double[] eval(int[] context, double[] prior, opennlp.tools.ml.model.EvalParameters model)
    Evaluates a `NaiveBayesModel`.
    Parameters:
      `context` - The context parameters as `int[]`.
      `prior` - The data prior to the evaluation as `double[]`.
      `model` - The `EvalParameters` used for evaluation.
    Returns:
      The resulting evaluation data as `double[]`.