Class TensorFlowSequenceModel<T extends Output<T>>

java.lang.Object
org.tribuo.sequence.SequenceModel<T>
org.tribuo.interop.tensorflow.sequence.TensorFlowSequenceModel<T>
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>, Serializable, AutoCloseable

public class TensorFlowSequenceModel<T extends Output<T>> extends SequenceModel<T> implements AutoCloseable
A TensorFlow model which implements SequenceModel, suitable for use in sequential prediction tasks.

N.B. TensorFlow support is experimental and may change without a major version bump.

See Also:
  • Field Details

  • Method Details

    • predict

      public List<Prediction<T>> predict(SequenceExample<T> example)
      Description copied from class: SequenceModel
      Uses the model to predict the output for a single example.
      Specified by:
      predict in class SequenceModel<T extends Output<T>>
      Parameters:
      example - the example to predict.
      Returns:
      the result of the prediction.
    • getTopFeatures

      public Map<String,List<com.oracle.labs.mlrg.olcut.util.Pair<String,Double>>> getTopFeatures(int i)
      Returns an empty map, as the top features are not well defined for most TensorFlow models.
      Specified by:
      getTopFeatures in class SequenceModel<T extends Output<T>>
      Parameters:
      i - the number of features to return. If this value is less than 0, all features should be returned for each class, unless the model cannot score it's features.
      Returns:
      a map from string outputs to an ordered list of pairs of feature names and weights associated with that feature in the model
    • close

      public void close()
      Close the session and graph if they exist.
      Specified by:
      close in interface AutoCloseable