opennlp.tools.ml.maxent.quasinewton

## 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

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class opennlp.tools.ml.model.AbstractModel

      `AbstractModel.ModelType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QNModel(Context[] params, String[] predLabels, String[] outcomeNames)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double[]` | `eval(String[] context)` Evaluates a context.
    `double[]` | `eval(String[] context, double[] probs)` Evaluates a context.
    `double[]` | `eval(String[] context, float[] values)` Evaluates a contexts with the specified context values.
    `int` | `getNumOutcomes()` Returns the number of outcomes for this model.

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

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

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

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

- - ### Constructor Detail

    - #### QNModel

          public QNModel(Context[] params,
                         String[] predLabels,
                         String[] outcomeNames)

  - ### Method Detail

    - #### getNumOutcomes

          public int getNumOutcomes()

      Description copied from interface: `MaxentModel`
      Returns the number of outcomes for this model.
      Specified by:
        `getNumOutcomes` in interface `MaxentModel`
      Overrides:
        `getNumOutcomes` in class `AbstractModel`
      Returns:
        The number of outcomes.

    - #### 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,
                               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)

      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.

Copyright © 2026 The Apache Software Foundation. All rights reserved.