Package org.tribuo.interop.tensorflow
org.tribuo.interop.tensorflow.sequence
.
Tribuo's TensorFlow support operates in Graph mode, as in v0.3.1 that is the only way to access gradients. The set of supported gradients is determined by TensorFlow, and not all gradients are available in TensorFlow Java in v0.3.1. Unsupported gradients will trigger an exception when the train method is called.
Models can store their trained parameters in two ways, either inside the Tribuo serialized model file
(using TensorFlowTrainer.TFModelFormat.TRIBUO_NATIVE
) or as a
TensorFlow checkpoint folder on disk (using TensorFlowTrainer.TFModelFormat.CHECKPOINT
).
The choice is made at training time, as they result in slightly different TF graph structures.
Similarly there are two supported kinds of ExternalModel
for TensorFlow,
TensorFlowSavedModelExternalModel
which loads a SavedModelBundle
and always reads from that path, and TensorFlowFrozenExternalModel
which
loads a TensorFlow v1 frozen graph and stores the graph inside the Tribuo serialized object.
There are two main interfaces for interacting with TensorFlow Tensors,
FeatureConverter
and
OutputConverter
, with
provide conversions to and from Tribuo's features and outputs respectively. There
are implementations of a dense feature transformation and one for images as 3d arrays,
along with output converters for Label
Regressor
, and MultiLabel
.
The loss function and output transformation used is controlled by the OutputConverter
,
if a different one is desired then users are recommended to implement that interface separately.
N.B. TensorFlow support is experimental and may change without a major version bump.
-
ClassDescriptionConverts a sparse example into a dense float vector, then wraps it in a
TFloat32
.An enum for the gradient optimisers exposed by TensorFlow-Java.Image converter.Can convert aLabel
into aTensor
containing one hot encoding of the label and can convert aTFloat16
orTFloat32
into aPrediction
or aLabel
.Can convert aMultiLabel
into aTensor
containing a binary encoding of the label vector and can convert aTFloat16
orTFloat32
into aPrediction
or aMultiLabel
.OutputConverter<T extends Output<T>>Converts theOutput
into aTensor
and vice versa.TensorFlowCheckpointModel<T extends Output<T>>This model encapsulates a simple model with an input feed dict, and produces a single output tensor.TensorFlowFrozenExternalModel<T extends Output<T>>A Tribuo wrapper around a TensorFlow frozen model.TensorFlowModel<T extends Output<T>>Base class for a TensorFlow model that operates onExample
s.TensorFlowNativeModel<T extends Output<T>>This model encapsulates a TensorFlow model running in graph mode with a single tensor output.TensorFlowSavedModelExternalModel<T extends Output<T>>A Tribuo wrapper around a TensorFlow saved model bundle.TensorFlowTrainer<T extends Output<T>>Trainer for TensorFlow.Provenance forTensorFlowTrainer
.The model format to emit.Helper functions for working with TensorFlow.A serializable tuple containing the tensor class name, the shape and the data.A map of names and tensors to feed into a session.Build and run a Tensorflow multi-class classifier for a standard dataset.Type of feature extractor.Options for training a model in TensorFlow.