Package opennlp.tools.ml.model
Class AbstractModel
java.lang.Object
opennlp.tools.ml.model.AbstractModel
- All Implemented Interfaces:
- MaxentModel
- Direct Known Subclasses:
- GISModel,- NaiveBayesModel,- PerceptronModel,- QNModel
A basic 
MaxentModel implementation.- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractModel(Context[] params, String[] predLabels, String[] outcomeNames) Initializes anAbstractModel.
- 
Method SummaryModifier 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.intRetrieves the index associated with the String name of the given outcome.intfinal StringgetOutcome(int i) Retrieves the String name of the outcome associated with the indexi.inthashCode()Methods inherited from class java.lang.ObjectgetClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface opennlp.tools.ml.model.MaxentModeleval, eval, eval
- 
Constructor Details- 
AbstractModelInitializes anAbstractModel.- Parameters:
- params- The- parametersto set.
- predLabels- The predicted labels.
- outcomeNames- The names of the outcomes.
 
 
- 
- 
Method Details- 
getBestOutcomeReturn the name of the outcome corresponding to the highest likelihood in the parameter ocs.- Specified by:
- getBestOutcomein interface- MaxentModel
- Parameters:
- ocs- A- double[]as returned by the- method.
- Returns:
- The name of the most likely outcome.
 
- 
getModelType- Returns:
- Retrieves the AbstractModel.ModelType.
 
- 
getAllOutcomesRetrieves a string matching all the outcome names with all the probabilities produced by theMaxentModel.eval(String[])method.- Specified by:
- getAllOutcomesin interface- MaxentModel
- Parameters:
- ocs- A- double[]as returned by the- MaxentModel.eval(String[])method.
- Returns:
- String containing outcome names paired with the normalized
            probability (contained in the double[] ocs) for each one.
 
- 
getOutcomeDescription copied from interface:MaxentModelRetrieves the String name of the outcome associated with the indexi.- Specified by:
- getOutcomein interface- MaxentModel
- Parameters:
- i- An outcome id.
- Returns:
- Retrieves the name of the outcome associated with id.
 
- 
getIndexDescription copied from interface:MaxentModelRetrieves the index associated with the String name of the given outcome.- Specified by:
- getIndexin interface- 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.
 
- 
getNumOutcomespublic int getNumOutcomes()- Specified by:
- getNumOutcomesin interface- MaxentModel
- Returns:
- Retrieves the number of outcomes for this model.
 
- 
getDataStructuresProvides 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.
 
- 
hashCodepublic int hashCode()
- 
equals
 
-