Class ViterbiModel
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>,Serializable
An implementation of a viterbi model.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes of label score aggregation. -
Field Summary
Fields inherited from class org.tribuo.sequence.SequenceModel
featureIDMap, name, outputIDMap, provenanceOutput -
Method Summary
Modifier and TypeMethodDescriptionGets the score aggregation function.intGets the stack size of this model.getTopFeatures(int n) Gets the topnfeatures associated with this model.getTopLabels(Map<String, Label> distribution) getTopLabels(Map<String, Label> distribution, int stackSize) List<List<Prediction<Label>>> predict(SequenceDataset<Label> examples) Uses the model to predict the labels for multiple examples contained in a data set.predict(SequenceExample<Label> examples) Uses the model to predict the output for a single example.Methods inherited from class org.tribuo.sequence.SequenceModel
getFeatureIDMap, getName, getOutputIDInfo, getProvenance, predict, setName, toMaxLabels, toString, validate
-
Method Details
-
predict
Description copied from class:SequenceModelUses the model to predict the labels for multiple examples contained in a data set.- Overrides:
predictin classSequenceModel<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
Description copied from class:SequenceModelUses the model to predict the output for a single example.- Specified by:
predictin classSequenceModel<Label>- Parameters:
examples- the example to predict.- Returns:
- the result of the prediction.
-
getTopLabels
-
getTopLabels
-
getStackSize
public int getStackSize()Gets the stack size of this model.- Returns:
- The stack size.
-
getScoreAggregation
Gets the score aggregation function.- Returns:
- The score aggregation function.
-
getTopFeatures
Description copied from class:SequenceModelGets the topnfeatures 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:
getTopFeaturesin classSequenceModel<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
-