Class AbstractModel
java.lang.Object
opennlp.tools.ml.model.AbstractModel
- All Implemented Interfaces:
opennlp.tools.ml.model.MaxentModel
A basic
MaxentModel implementation.-
Constructor Summary
ConstructorsConstructorDescriptionAbstractModel(opennlp.tools.ml.model.Context[] params, String[] predLabels, String[] outcomeNames) Initializes anAbstractModel. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal StringgetAllOutcomes(double[] ocs) Retrieves a string matching all the outcome names with all the probabilities produced by theMaxentModel.eval(String[])method.final StringgetBestOutcome(double[] ocs) Return the name of the outcome corresponding to the highest likelihood in the parameter ocs.final Object[]Provides the fundamental data structures which encode theMaxentModelinformation.intopennlp.tools.ml.AlgorithmTypeintfinal StringgetOutcome(int i) inthashCode()Methods inherited from interface opennlp.tools.ml.model.MaxentModel
eval, eval, eval
-
Constructor Details
-
AbstractModel
public AbstractModel(opennlp.tools.ml.model.Context[] params, String[] predLabels, String[] outcomeNames) Initializes anAbstractModel.- Parameters:
params- Theparametersto set.predLabels- The predicted labels.outcomeNames- The names of the outcomes.
-
-
Method Details
-
getBestOutcome
Return the name of the outcome corresponding to the highest likelihood in the parameter ocs.- Specified by:
getBestOutcomein interfaceopennlp.tools.ml.model.MaxentModel- Parameters:
ocs- Adouble[]as returned by themethod.- Returns:
- The name of the most likely outcome.
-
getModelType
public opennlp.tools.ml.AlgorithmType getModelType()- Returns:
- Retrieves the
AlgorithmType.
-
getAllOutcomes
Retrieves a string matching all the outcome names with all the probabilities produced by theMaxentModel.eval(String[])method.- Specified by:
getAllOutcomesin interfaceopennlp.tools.ml.model.MaxentModel- Parameters:
ocs- Adouble[]as returned by theMaxentModel.eval(String[])method.- Returns:
- String containing outcome names paired with the normalized
probability (contained in the
double[] ocs) for each one.
-
getOutcome
- Specified by:
getOutcomein interfaceopennlp.tools.ml.model.MaxentModel- Parameters:
i- An outcome id.- Returns:
- Retrieves the name of the outcome associated with
id.
-
getIndex
- Specified by:
getIndexin interfaceopennlp.tools.ml.model.MaxentModel- Parameters:
outcome- The String name of the outcome for which the index is desired.- Returns:
- Retrieves the index if the given
outcomelabel exists for this model,-1if it does not.
-
getNumOutcomes
public int getNumOutcomes()- Specified by:
getNumOutcomesin interfaceopennlp.tools.ml.model.MaxentModel
-
getDataStructures
Provides the fundamental data structures which encode theMaxentModelinformation.The following values are held in the
Object[]which is returned by this method:- Returns:
- An
Objectarray with the values as described above.
-
hashCode
-
equals
-