public final class ViterbiTrainer extends Object implements SequenceTrainer<Label>
Trainer
.
Has a parameter to control the label features which are added to the features supplied by the data.Constructor and Description |
---|
ViterbiTrainer(Trainer<Label> trainer,
LabelFeatureExtractor labelFeatureExtractor,
int stackSize,
ViterbiModel.ScoreAggregation scoreAggregation) |
ViterbiTrainer(Trainer<Label> trainer,
LabelFeatureExtractor labelFeatureExtractor,
ViterbiModel.ScoreAggregation scoreAggregation) |
Modifier and Type | Method and Description |
---|---|
int |
getInvocationCount()
Returns the number of times the train method has been invoked.
|
TrainerProvenance |
getProvenance() |
String |
toString() |
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 regular
Model train method, but before it does, it adds features derived
from preceding labels. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
train
public ViterbiTrainer(Trainer<Label> trainer, LabelFeatureExtractor labelFeatureExtractor, ViterbiModel.ScoreAggregation scoreAggregation)
public ViterbiTrainer(Trainer<Label> trainer, LabelFeatureExtractor labelFeatureExtractor, int stackSize, ViterbiModel.ScoreAggregation scoreAggregation)
public SequenceModel<Label> train(SequenceDataset<Label> dataset, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
Model
train 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.train
in interface SequenceTrainer<Label>
dataset
- The input dataset.runProvenance
- Any additional information to record in the provenance.SequenceModel
using Viterbi wrapped around an inner Model
.public int getInvocationCount()
SequenceTrainer
getInvocationCount
in interface SequenceTrainer<Label>
public TrainerProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.