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>
Converts a sparse example into a dense float vector, then wraps it in a
Tensor
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Feature size beyond which a warning is generated (as ONNX requires dense features and large feature spaces are memory hungry).static final int
Number of times the feature size warning should be printed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
toString()
org.tensorflow.Tensor
<?> transform
(List<Example<T>> examples, ImmutableFeatureMap featureIDMap) Converts a batch ofExample
s into a singleTensor
suitable for supplying as an input to a graph.org.tensorflow.Tensor
<?> transform
(List<SparseVector> vectors) Converts a list ofSparseVector
s representing a batch of features into aTensor
.org.tensorflow.Tensor
<?> transform
(Example<T> example, ImmutableFeatureMap featureIDMap) Converts anExample
into aTensor
suitable for supplying as an input to a graph.org.tensorflow.Tensor
<?> transform
(SparseVector vector) Converts aSparseVector
representing the features into aTensor
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Field Details
-
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
Number of times the feature size warning should be printed.- See Also:
-
-
Constructor Details
-
DenseTransformer
public DenseTransformer()
-
-
Method Details
-
transform
Description copied from interface:ExampleTransformer
Converts anExample
into aTensor
suitable for supplying as an input to a graph.It generates it as a single example minibatch.
- Specified by:
transform
in interfaceExampleTransformer<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 ofExample
s into a singleTensor
suitable for supplying as an input to a graph.- Specified by:
transform
in interfaceExampleTransformer<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
Description copied from interface:ExampleTransformer
Converts aSparseVector
representing the features into aTensor
.It generates it as a single example minibatch.
- Specified by:
transform
in interfaceExampleTransformer<T extends Output<T>>
- Parameters:
vector
- The features to convert.- Returns:
- A dense Tensor representing this vector.
-
transform
Description copied from interface:ExampleTransformer
Converts a list ofSparseVector
s representing a batch of features into aTensor
.- Specified by:
transform
in interfaceExampleTransformer<T extends Output<T>>
- Parameters:
vectors
- The batch of features to convert.- Returns:
- A dense Tensor representing this minibatch.
-
toString
-
getProvenance
-