Class NaiveBayesModel
- Namespace
- NOpenNLP.Tools.Ml.Naivebayes
- Assembly
- NOpenNLP.Tools.dll
Class implementing the multinomial Naive Bayes classifier model.
public class NaiveBayesModel : AbstractModel, IMaxentModel
- Inheritance
-
NaiveBayesModel
- Implements
- Inherited Members
Constructors
NaiveBayesModel(Context[], string[], string[])
public NaiveBayesModel(Context[] @params, string[] predLabels, string[] outcomeNames)
Parameters
Fields
outcomeTotals
protected readonly double[] outcomeTotals
Field Value
- double[]
vocabulary
protected long vocabulary
Field Value
Methods
Eval(int[], double[], EvalParameters)
public static double[] Eval(int[] context, double[] prior, EvalParameters model)
Parameters
contextint[]priordouble[]modelEvalParameters
Returns
- double[]
Eval(string[])
Evaluates a context.
public override double[] Eval(string[] context)
Parameters
contextstring[]A list of String names of the contextual predicates which are to be evaluated together.
Returns
- double[]
an array of the probabilities for each of the different outcomes, all of which sum to 1.
Eval(string[], double[])
Evaluates a context.
public override double[] Eval(string[] context, double[] probs)
Parameters
contextstring[]A list of String names of the contextual predicates which are to be evaluated together.
probsdouble[]An array which is populated with the probabilities for each of the different outcomes, all of which sum to 1.
Returns
- double[]
an array of the probabilities for each of the different outcomes, all of which sum to 1.
Eval(string[], float[])
Evaluates a contexts with the specified context values.
public override double[] Eval(string[] context, float[] values)
Parameters
contextstring[]A list of String names of the contextual predicates which are to be evaluated together.
valuesfloat[]The values associated with each context.
Returns
- double[]
an array of the probabilities for each of the different outcomes, all of which sum to 1.
Eval(string[], float[]?, double[])
public virtual double[] Eval(string[] context, float[]? values, double[] outsums)
Parameters
Returns
- double[]
InitOutcomeTotals(string[], Context[])
protected virtual double[] InitOutcomeTotals(string[] outcomeNames, Context[] @params)
Parameters
Returns
- double[]