Package org.tribuo.sequence
Class IndependentSequenceModel<T extends Output<T>>
java.lang.Object
org.tribuo.sequence.SequenceModel<T>
org.tribuo.sequence.IndependentSequenceModel<T>
- Type Parameters:
T
- The output type.
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>
,Serializable
A SequenceModel which independently predicts each element of the sequence.
- See Also:
-
Field Summary
Fields inherited from class org.tribuo.sequence.SequenceModel
featureIDMap, name, outputIDMap, provenanceOutput
-
Method Summary
Modifier and TypeMethodDescriptiongetTopFeatures
(int n) Gets the topn
features associated with this model.List<Prediction<T>>
predict
(SequenceExample<T> example) Uses the model to predict the output for a single example.Methods inherited from class org.tribuo.sequence.SequenceModel
getFeatureIDMap, getName, getOutputIDInfo, getProvenance, predict, predict, setName, toMaxLabels, toString, validate
-
Method Details
-
predict
Description copied from class:SequenceModel
Uses the model to predict the output for a single example.- Specified by:
predict
in classSequenceModel<T extends Output<T>>
- Parameters:
example
- the example to predict.- Returns:
- the result of the prediction.
-
getTopFeatures
Description copied from class:SequenceModel
Gets the topn
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 classSequenceModel<T extends Output<T>>
- 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
-