Class DenseTransformer<T extends Output<T>>

java.lang.Object
org.tribuo.interop.tensorflow.DenseTransformer<T>
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, Serializable, ExampleTransformer<T>

public class DenseTransformer<T extends Output<T>> extends Object implements ExampleTransformer<T>
Converts a sparse example into a dense float vector, then wraps it in a Tensor.
See Also:
  • Field Details

    • THRESHOLD

      public static final int THRESHOLD
      Feature size beyond which a warning is generated (as ONNX requires dense features and large feature spaces are memory hungry).
      See Also:
    • WARNING_THRESHOLD

      public static final int WARNING_THRESHOLD
      Number of times the feature size warning should be printed.
      See Also:
  • Constructor Details

  • Method Details

    • transform

      public org.tensorflow.Tensor<?> transform(Example<T> example, ImmutableFeatureMap featureIDMap)
      Description copied from interface: ExampleTransformer
      Converts an Example into a Tensor suitable for supplying as an input to a graph.

      It generates it as a single example minibatch.

      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      example - The example to convert.
      featureIDMap - The id map to convert feature names into id numbers.
      Returns:
      A dense Tensor representing this example.
    • transform

      public org.tensorflow.Tensor<?> transform(List<Example<T>> examples, ImmutableFeatureMap featureIDMap)
      Description copied from interface: ExampleTransformer
      Converts a batch of Examples into a single Tensor suitable for supplying as an input to a graph.
      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      examples - The examples to convert.
      featureIDMap - THe id map to convert feature names into id numbers.
      Returns:
      A dense Tensor representing this minibatch.
    • transform

      public org.tensorflow.Tensor<?> transform(SparseVector vector)
      Description copied from interface: ExampleTransformer
      Converts a SparseVector representing the features into a Tensor.

      It generates it as a single example minibatch.

      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      vector - The features to convert.
      Returns:
      A dense Tensor representing this vector.
    • transform

      public org.tensorflow.Tensor<?> transform(List<SparseVector> vectors)
      Description copied from interface: ExampleTransformer
      Converts a list of SparseVectors representing a batch of features into a Tensor.

      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      vectors - The batch of features to convert.
      Returns:
      A dense Tensor representing this minibatch.
    • toString

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

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