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 intFeature size beyond which a warning is generated (as ONNX requires dense features and large feature spaces are memory hungry).static final intNumber of times the feature size warning should be printed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenancetoString()org.tensorflow.Tensor<?> transform(List<Example<T>> examples, ImmutableFeatureMap featureIDMap) Converts a batch ofExamples into a singleTensorsuitable for supplying as an input to a graph.org.tensorflow.Tensor<?> transform(List<SparseVector> vectors) Converts a list ofSparseVectors representing a batch of features into aTensor.org.tensorflow.Tensor<?> transform(Example<T> example, ImmutableFeatureMap featureIDMap) Converts anExampleinto aTensorsuitable for supplying as an input to a graph.org.tensorflow.Tensor<?> transform(SparseVector vector) Converts aSparseVectorrepresenting the features into aTensor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:ExampleTransformerConverts anExampleinto aTensorsuitable for supplying as an input to a graph.It generates it as a single example minibatch.
- Specified by:
transformin 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:ExampleTransformerConverts a batch ofExamples into a singleTensorsuitable for supplying as an input to a graph.- Specified by:
transformin 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:ExampleTransformerConverts aSparseVectorrepresenting the features into aTensor.It generates it as a single example minibatch.
- Specified by:
transformin interfaceExampleTransformer<T extends Output<T>>- Parameters:
vector- The features to convert.- Returns:
- A dense Tensor representing this vector.
-
transform
Description copied from interface:ExampleTransformerConverts a list ofSparseVectors representing a batch of features into aTensor.- Specified by:
transformin interfaceExampleTransformer<T extends Output<T>>- Parameters:
vectors- The batch of features to convert.- Returns:
- A dense Tensor representing this minibatch.
-
toString
-
getProvenance
-