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,ProtoSerializable<org.tribuo.interop.tensorflow.protos.FeatureConverterProto>
Converts a sparse example into a dense float vector, then wraps it in a
TFloat32.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intProtobuf serialization version.static final intFeature size beyond which a warning is generated (as TensorFlow requires dense features and large feature spaces are memory hungry).static final intNumber of times the feature size warning should be printed.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Constructor Summary
ConstructorsConstructorDescriptionDenseFeatureConverter(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) static DenseFeatureConverterdeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.booleancom.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenanceinthashCode()Gets a view of the names of the inputs this converter produces.org.tribuo.interop.tensorflow.protos.FeatureConverterProtoSerializes this object to a protobuf.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
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
-
deserializeFromProto
public static DenseFeatureConverter deserializeFromProto(int version, String className, com.google.protobuf.Any message) throws com.google.protobuf.InvalidProtocolBufferException Deserialization factory.- Parameters:
version- The serialized object version.className- The class name.message- The serialized data.- Returns:
- The deserialized object.
- Throws:
com.google.protobuf.InvalidProtocolBufferException- If the protobuf could not be parsed from themessage.
-
serialize
public org.tribuo.interop.tensorflow.protos.FeatureConverterProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Specified by:
serializein interfaceProtoSerializable<org.tribuo.interop.tensorflow.protos.FeatureConverterProto>- Returns:
- The protobuf.
-
equals
-
hashCode
-
convert
Description copied from interface:FeatureConverterConverts anExampleinto aTensorMapsuitable for supplying as an input to a graph.It generates it as a single example minibatch.
- Specified by:
convertin 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:
convertin 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:FeatureConverterConverts aSGDVectorrepresenting the features into aTensorMap.It generates it as a single example minibatch.
- Specified by:
convertin 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:
convertin 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:FeatureConverterGets a view of the names of the inputs this converter produces.- Specified by:
inputNamesSetin interfaceFeatureConverter- Returns:
- The input names.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-