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.

  • Constructor Details

    • HashingSequenceTrainer

      public HashingSequenceTrainer(SequenceTrainer<T> trainer, Hasher hasher)
      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 the SequenceDataset, 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 interface SequenceTrainer<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 interface SequenceTrainer<T extends Output<T>>
      Returns:
      The number of times train has been invoked.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProvenance

      public TrainerProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<T extends Output<T>>