Klasse AbstractModel

java.lang.Object
opennlp.tools.ml.model.AbstractModel
Alle implementierten Schnittstellen:
MaxentModel
Bekannte direkte Unterklassen:
GISModel, NaiveBayesModel, PerceptronModel, QNModel

public abstract class AbstractModel extends Object implements MaxentModel
A basic MaxentModel implementation.
  • Konstruktordetails

    • AbstractModel

      public AbstractModel(Context[] params, String[] predLabels, String[] outcomeNames)
      Initializes an AbstractModel.
      Parameter:
      params - The parameters to set.
      predLabels - The predicted labels.
      outcomeNames - The names of the outcomes.
  • Methodendetails

    • getBestOutcome

      public final String getBestOutcome(double[] ocs)
      Return the name of the outcome corresponding to the highest likelihood in the parameter ocs.
      Angegeben von:
      getBestOutcome in Schnittstelle MaxentModel
      Parameter:
      ocs - A double[] as returned by the eval(String[] context) method.
      Gibt zurück:
      The name of the most likely outcome.
    • getModelType

      public AbstractModel.ModelType getModelType()
      Gibt zurück:
      Retrieves the AbstractModel.ModelType.
    • getAllOutcomes

      public final String getAllOutcomes(double[] ocs)
      Retrieves a string matching all the outcome names with all the probabilities produced by the MaxentModel.eval(String[]) method.
      Angegeben von:
      getAllOutcomes in Schnittstelle MaxentModel
      Parameter:
      ocs - A double[] as returned by the MaxentModel.eval(String[]) method.
      Gibt zurück:
      String containing outcome names paired with the normalized probability (contained in the double[] ocs) for each one.
    • getOutcome

      public final String getOutcome(int i)
      Beschreibung aus Schnittstelle kopiert: MaxentModel
      Retrieves the String name of the outcome associated with the index i.
      Angegeben von:
      getOutcome in Schnittstelle MaxentModel
      Parameter:
      i - An outcome id.
      Gibt zurück:
      Retrieves the name of the outcome associated with that id.
    • getIndex

      public int getIndex(String outcome)
      Beschreibung aus Schnittstelle kopiert: MaxentModel
      Retrieves the index associated with the String name of the given outcome.
      Angegeben von:
      getIndex in Schnittstelle MaxentModel
      Parameter:
      outcome - The String name of the outcome for which the index is desired.
      Gibt zurück:
      Retrieves the index if the given outcome label exists for this model, -1 if it does not.
    • getNumOutcomes

      public int getNumOutcomes()
      Angegeben von:
      getNumOutcomes in Schnittstelle MaxentModel
      Gibt zurück:
      Retrieves the number of outcomes for this model.
    • getDataStructures

      public final Object[] getDataStructures()
      Provides the fundamental data structures which encode the maxent model information. Note: This method will usually only be needed by GIS model writers.

      The following values are held in the Object array which is returned by this method:

      • index 0: Context array containing the model parameters.
      • index 1: Map containing the mapping of model predicates to unique integers.
      • index 2: String array containing the names of the outcomes, stored in the index of the array which represents their unique ids in the model.
      Gibt zurück:
      An Object array with the values as described above.
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object