Class ViterbiModel

java.lang.Object
org.tribuo.sequence.SequenceModel<Label>
org.tribuo.classification.sequence.viterbi.ViterbiModel
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>, Serializable

public class ViterbiModel extends SequenceModel<Label>
An implementation of a viterbi model.
See Also:
  • Method Details

    • predict

      public List<List<Prediction<Label>>> predict(SequenceDataset<Label> examples)
      Description copied from class: SequenceModel
      Uses the model to predict the labels for multiple examples contained in a data set.
      Overrides:
      predict in class SequenceModel<Label>
      Parameters:
      examples - the data set containing the examples to predict.
      Returns:
      the results of the predictions, in the same order as the data set generates the example.
    • predict

      public List<Prediction<Label>> predict(SequenceExample<Label> examples)
      Description copied from class: SequenceModel
      Uses the model to predict the output for a single example.
      Specified by:
      predict in class SequenceModel<Label>
      Parameters:
      examples - the example to predict.
      Returns:
      the result of the prediction.
    • getTopLabels

      protected List<Label> getTopLabels(Map<String,Label> distribution)
    • getTopLabels

      protected static List<Label> getTopLabels(Map<String,Label> distribution, int stackSize)
    • getStackSize

      public int getStackSize()
      Gets the stack size of this model.
      Returns:
      The stack size.
    • getScoreAggregation

      public ViterbiModel.ScoreAggregation getScoreAggregation()
      Gets the score aggregation function.
      Returns:
      The score aggregation function.
    • getTopFeatures

      public Map<String,List<com.oracle.labs.mlrg.olcut.util.Pair<String,Double>>> getTopFeatures(int n)
      Description copied from class: SequenceModel
      Gets the top n features associated with this model.

      If the model does not produce per output feature lists, it returns a map with a single element with key Model.ALL_OUTPUTS.

      If the model cannot describe it's top features then it returns Collections.emptyMap().

      Specified by:
      getTopFeatures in class SequenceModel<Label>
      Parameters:
      n - the number of features to return. If this value is less than 0, all features should be returned for each class, unless the model cannot score it's features.
      Returns:
      a map from string outputs to an ordered list of pairs of feature names and weights associated with that feature in the model