Package org.tribuo.sequence
Class HashingSequenceTrainer<T extends Output<T>>
java.lang.Object
org.tribuo.sequence.HashingSequenceTrainer<T>
- Type Parameters:
T
- The type of the output.
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
,SequenceTrainer<T>
public final class HashingSequenceTrainer<T extends Output<T>>
extends Object
implements SequenceTrainer<T>
A SequenceTrainer that hashes all the feature names on the way in.
It wraps another SequenceTrainer which actually builds the SequenceModel
.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionHashingSequenceTrainer
(SequenceTrainer<T> trainer, Hasher hasher) Constructs a hashing sequence trainer using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of times the train method has been invoked.toString()
train
(SequenceDataset<T> sequenceExamples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance) This clones theSequenceDataset
, hashes each of the examples and rewrites their feature ids before passing it to the inner trainer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
Methods inherited from interface org.tribuo.sequence.SequenceTrainer
train
-
Constructor Details
-
HashingSequenceTrainer
Constructs a hashing sequence trainer using the supplied parameters.- Parameters:
trainer
- The sequence trainer to use.hasher
- The feature hasher to apply.
-
-
Method Details
-
train
public SequenceModel<T> train(SequenceDataset<T> sequenceExamples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance) This clones theSequenceDataset
, hashes each of the examples and rewrites their feature ids before passing it to the inner trainer.This ensures the Trainer sees the data after the collisions, and thus builds the correct size data structures.
- Specified by:
train
in interfaceSequenceTrainer<T extends Output<T>>
- Parameters:
sequenceExamples
- The input dataset.instanceProvenance
- Training run specific provenance information.- Returns:
- A trained
SequenceModel
.
-
getInvocationCount
public int getInvocationCount()Description copied from interface:SequenceTrainer
Returns the number of times the train method has been invoked.- Specified by:
getInvocationCount
in interfaceSequenceTrainer<T extends Output<T>>
- Returns:
- The number of times train has been invoked.
-
toString
-
getProvenance
-