Class QNModel
- java.lang.Object
-
- opennlp.tools.ml.model.AbstractModel
-
- opennlp.tools.ml.maxent.quasinewton.QNModel
-
- All Implemented Interfaces:
MaxentModel
public class QNModel extends AbstractModel
A maximum entropy model which has been trained using the Quasi Newton (QN) algorithm.- See Also:
AbstractModel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class opennlp.tools.ml.model.AbstractModel
AbstractModel.ModelType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
eval(String[] context)
Evaluates acontext
.double[]
eval(String[] context, double[] probs)
Evaluates acontext
.double[]
eval(String[] context, float[] values)
Evaluates acontext
with the specified contextvalues
.int
getNumOutcomes()
-
Methods inherited from class opennlp.tools.ml.model.AbstractModel
equals, getAllOutcomes, getBestOutcome, getDataStructures, getIndex, getModelType, getOutcome, hashCode
-
-
-
-
Constructor Detail
-
QNModel
public QNModel(Context[] params, String[] predLabels, String[] outcomeNames)
Initializes aQNModel
with the specified parameters, outcome names, and predicate/feature labels.- Parameters:
params
- Theparameters
of the model.predLabels
- The names of the predicates used in this model.outcomeNames
- The names of the outcomes this model predicts.
-
-
Method Detail
-
getNumOutcomes
public int getNumOutcomes()
- Specified by:
getNumOutcomes
in interfaceMaxentModel
- Overrides:
getNumOutcomes
in classAbstractModel
- Returns:
- Retrieves the number of outcomes for this model.
-
eval
public double[] eval(String[] context)
Evaluates acontext
.- Parameters:
context
- An array 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, double[] probs)
Evaluates acontext
.- Parameters:
context
- An array 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)
Evaluates acontext
with the specified contextvalues
.- Parameters:
context
- An array 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
.
-
-