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

params Context[]
predLabels string[]
outcomeNames string[]

Fields

outcomeTotals

protected readonly double[] outcomeTotals

Field Value

double[]

vocabulary

protected long vocabulary

Field Value

long

Methods

Eval(int[], double[], EvalParameters)

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

Parameters

context int[]
prior double[]
model EvalParameters

Returns

double[]

Eval(string[])

Evaluates a context.

public override double[] Eval(string[] context)

Parameters

context string[]

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

context string[]

A list of String names of the contextual predicates which are to be evaluated together.

probs double[]

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

context string[]

A list of String names of the contextual predicates which are to be evaluated together.

values float[]

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

context string[]
values float[]
outsums double[]

Returns

double[]

InitOutcomeTotals(string[], Context[])

protected virtual double[] InitOutcomeTotals(string[] outcomeNames, Context[] @params)

Parameters

outcomeNames string[]
params Context[]

Returns

double[]