Class NaiveBayesModel

  • All Implemented Interfaces:
    MaxentModel

    public class NaiveBayesModel
    extends AbstractModel
    Class implementing the multinomial Naive Bayes classifier model.
    • Constructor Detail

      • NaiveBayesModel

        public NaiveBayesModel​(Context[] params,
                               String[] predLabels,
                               String[] outcomeNames)
    • Method Detail

      • eval

        public double[] eval​(String[] context)
        Description copied from interface: MaxentModel
        Evaluates a context.
        Parameters:
        context - A list of String names of the contextual predicates which are to be evaluated together.
        Returns:
        an array of the probabilities for each of the different outcomes, all of which sum to 1.
      • eval

        public double[] eval​(String[] context,
                             float[] values)
        Description copied from interface: MaxentModel
        Evaluates a contexts with the specified context values.
        Parameters:
        context - A list of String names of the contextual predicates which are to be evaluated together.
        values - The values associated with each context.
        Returns:
        an array of the probabilities for each of the different outcomes, all of which sum to 1.
      • eval

        public double[] eval​(String[] context,
                             double[] probs)
        Description copied from interface: MaxentModel
        Evaluates a context.
        Parameters:
        context - A list of String names of the contextual predicates which are to be evaluated together.
        probs - An array which is populated with the probabilities for each of the different outcomes, all of which sum to 1.
        Returns:
        an array of the probabilities for each of the different outcomes, all of which sum to 1.
      • eval

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

        public static double[] eval​(int[] context,
                                    double[] prior,
                                    EvalParameters model)