opennlp.model
Interface MaxentModel

All Known Implementing Classes:
AbstractModel, GISModel, PerceptronModel

public interface MaxentModel

Interface for maximum entropy models.


Method Summary
 double[] eval(java.lang.String[] context)
          Evaluates a context.
 double[] eval(java.lang.String[] context, double[] probs)
          Evaluates a context.
 double[] eval(java.lang.String[] context, float[] values)
          Evaluates a contexts with the specified context values.
 java.lang.String getAllOutcomes(double[] outcomes)
          Return a string matching all the outcome names with all the probabilities produced by the eval(String[] context) method.
 java.lang.String getBestOutcome(double[] outcomes)
          Simple function to return the outcome associated with the index containing the highest probability in the double[].
 java.lang.Object[] getDataStructures()
          Returns the data structures relevant to storing the model.
 int getIndex(java.lang.String outcome)
          Gets the index associated with the String name of the given outcome.
 int getNumOutcomes()
          Returns the number of outcomes for this model.
 java.lang.String getOutcome(int i)
          Gets the String name of the outcome associated with the index i.
 

Method Detail

eval

double[] eval(java.lang.String[] context)
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

double[] eval(java.lang.String[] context,
              double[] probs)
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

double[] eval(java.lang.String[] context,
              float[] values)
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.

getBestOutcome

java.lang.String getBestOutcome(double[] outcomes)
Simple function to return the outcome associated with the index containing the highest probability in the double[].

Parameters:
outcomes - A double[] as returned by the eval(String[] context) method.
Returns:
the String name of the best outcome

getAllOutcomes

java.lang.String getAllOutcomes(double[] outcomes)
Return a string matching all the outcome names with all the probabilities produced by the eval(String[] context) method.

Parameters:
outcomes - A double[] as returned by the eval(String[] context) method.
Returns:
String containing outcome names paired with the normalized probability (contained in the double[] ocs) for each one.

getOutcome

java.lang.String getOutcome(int i)
Gets the String name of the outcome associated with the index i.

Parameters:
i - the index for which the name of the associated outcome is desired.
Returns:
the String name of the outcome

getIndex

int getIndex(java.lang.String outcome)
Gets the index associated with the String name of the given outcome.

Parameters:
outcome - the String name of the outcome for which the index is desired
Returns:
the index if the given outcome label exists for this model, -1 if it does not.

getDataStructures

java.lang.Object[] getDataStructures()
Returns the data structures relevant to storing the model.


getNumOutcomes

int getNumOutcomes()
Returns the number of outcomes for this model.

Returns:
The number of outcomes.


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.