Class ViterbiTrainer
java.lang.Object
org.tribuo.classification.sequence.viterbi.ViterbiTrainer
- All Implemented Interfaces:
- com.oracle.labs.mlrg.olcut.config.Configurable,- com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>,- SequenceTrainer<Label>
Builds a Viterbi model using the supplied 
Trainer.
 Has a parameter to control the label features which are added to the features supplied by the data.- 
Constructor SummaryConstructorsConstructorDescriptionViterbiTrainer(Trainer<Label> trainer, LabelFeatureExtractor labelFeatureExtractor, int stackSize, ViterbiModel.ScoreAggregation scoreAggregation) ViterbiTrainer(Trainer<Label> trainer, LabelFeatureExtractor labelFeatureExtractor, ViterbiModel.ScoreAggregation scoreAggregation) 
- 
Method SummaryModifier and TypeMethodDescriptionintReturns the number of times the train method has been invoked.toString()train(SequenceDataset<Label> dataset, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) The viterbi train method is unique because it delegates to a regularModeltrain method, but before it does, it adds features derived from preceding labels.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.ConfigurablepostConfigMethods inherited from interface org.tribuo.sequence.SequenceTrainertrain
- 
Constructor Details- 
ViterbiTrainerpublic ViterbiTrainer(Trainer<Label> trainer, LabelFeatureExtractor labelFeatureExtractor, ViterbiModel.ScoreAggregation scoreAggregation) 
- 
ViterbiTrainerpublic ViterbiTrainer(Trainer<Label> trainer, LabelFeatureExtractor labelFeatureExtractor, int stackSize, ViterbiModel.ScoreAggregation scoreAggregation) 
 
- 
- 
Method Details- 
trainpublic SequenceModel<Label> train(SequenceDataset<Label> dataset, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) The viterbi train method is unique because it delegates to a regularModeltrain method, but before it does, it adds features derived from preceding labels. The pipeline upstream of this call should not care that these features are being added - that is, we would not want to make the upstream logic worry about what kind of trainer will be used and have conditional logic that says to add special label-derived features if using the ViterbiTrainer. So, these one-of-a-kind unique-in-the-world label-derived features are generated here and added to the sequence examples of the passed in dataset. If you pass in a MutableSequenceDataset, then please be aware that your dataset will be modified after calling this method and therefore subsequent calls to other SequenceModel.train methods with your dataset should be avoided. If you pass in an ImmutableSequenceDataset, then please be aware that your entire dataset is going to be copied as a MutableSequenceDataset - so there is a memory penalty.- Specified by:
- trainin interface- SequenceTrainer<Label>
- Parameters:
- dataset- The input dataset.
- runProvenance- Any additional information to record in the provenance.
- Returns:
- A SequenceModelusing Viterbi wrapped around an innerModel.
 
- 
getInvocationCountpublic int getInvocationCount()Description copied from interface:SequenceTrainerReturns the number of times the train method has been invoked.- Specified by:
- getInvocationCountin interface- SequenceTrainer<Label>
- Returns:
- The number of times train has been invoked.
 
- 
toString
- 
getProvenance- Specified by:
- getProvenancein interface- com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
 
 
-