Class HashingSequenceTrainer<T extends Output<T>>

Type Parameters:
T - The type of the output.
All Implemented Interfaces:,<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.
      trainer - The sequence trainer to use.
      hasher - The feature hasher to apply.
  • Method Details

    • train

      public SequenceModel<T> train(SequenceDataset<T> sequenceExamples, Map<String,> 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>>
      sequenceExamples - The input dataset.
      instanceProvenance - Training run specific provenance information.
      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>>
      The number of times train has been invoked.
    • toString

      public String toString()
      toString in class Object
    • getProvenance

      public TrainerProvenance getProvenance()
      Specified by:
      getProvenance in interface<T extends Output<T>>