Package org.tribuo.interop.tensorflow
Class DenseFeatureConverter
java.lang.Object
org.tribuo.interop.tensorflow.DenseFeatureConverter
- 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
,FeatureConverter
Converts a sparse example into a dense float vector, then wraps it in a
TFloat32
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Feature size beyond which a warning is generated (as TensorFlow 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
ConstructorDescriptionDenseFeatureConverter
(String inputName) Builds a DenseFeatureConverter, setting the input name. -
Method Summary
Modifier and TypeMethodDescriptionconvert
(List<? extends Example<?>> examples, ImmutableFeatureMap featureIDMap) convert
(Example<?> example, ImmutableFeatureMap featureIDMap) com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
Gets a view of the names of the inputs this converter produces.toString()
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
public static final int THRESHOLDFeature size beyond which a warning is generated (as TensorFlow requires dense features and large feature spaces are memory hungry).- See Also:
-
WARNING_THRESHOLD
public static final int WARNING_THRESHOLDNumber of times the feature size warning should be printed.- See Also:
-
-
Constructor Details
-
DenseFeatureConverter
Builds a DenseFeatureConverter, setting the input name.- Parameters:
inputName
- The placeholder input name.
-
-
Method Details
-
convert
Description copied from interface:FeatureConverter
Converts anExample
into aTensorMap
suitable for supplying as an input to a graph.It generates it as a single example minibatch.
- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
example
- The example to convert.featureIDMap
- The id map to convert feature names into id numbers.- Returns:
- A TensorMap (similar to a TF Python feed_dict) representing the features in this example.
-
convert
Description copied from interface:FeatureConverter
- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
examples
- The examples to convert.featureIDMap
- THe id map to convert feature names into id numbers.- Returns:
- A TensorMap (similar to a TF Python feed_dict) representing the features in this minibatch.
-
convert
Description copied from interface:FeatureConverter
Converts aSGDVector
representing the features into aTensorMap
.It generates it as a single example minibatch.
- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
vector
- The features to convert.- Returns:
- A TensorMap (similar to a TF Python feed_dict) representing this vector.
-
convert
Description copied from interface:FeatureConverter
- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
vectors
- The batch of features to convert.- Returns:
- A TensorMap (similar to a TF Python feed_dict) representing this minibatch.
-
inputNamesSet
Description copied from interface:FeatureConverter
Gets a view of the names of the inputs this converter produces.- Specified by:
inputNamesSet
in interfaceFeatureConverter
- Returns:
- The input names.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-