Package org.tribuo.math.util
Class Normalizer
java.lang.Object
org.tribuo.math.util.Normalizer
- All Implemented Interfaces:
Serializable
,VectorNormalizer
,ProtoSerializable<org.tribuo.math.protos.NormalizerProto>
Normalizes, but first subtracts the minimum value (to ensure positivity).
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Protobuf serialization version.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Normalizer
deserializeFromProto
(int version, String className, com.google.protobuf.Any message) Deserialization factory.boolean
exportNormalizer
(ONNXNode input) Applies ONNX ReduceMin, Sub, ReduceSum, and Div operations to input.int
hashCode()
double[]
normalize
(double[] input) Normalizes the input array in some fashion specified by the class.void
normalizeInPlace
(double[] input) In place normalization of the array.org.tribuo.math.protos.NormalizerProto
Serializes this object to a protobuf.
-
Field Details
-
CURRENT_VERSION
public static final int CURRENT_VERSIONProtobuf serialization version.- See Also:
-
-
Constructor Details
-
Normalizer
public Normalizer()Constructs a Normalizer.
-
-
Method Details
-
deserializeFromProto
public static Normalizer deserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.- Parameters:
version
- The serialized object version.className
- The class name.message
- The serialized data.- Returns:
- The deserialized object.
-
serialize
public org.tribuo.math.protos.NormalizerProto serialize()Description copied from interface:ProtoSerializable
Serializes this object to a protobuf.- Specified by:
serialize
in interfaceProtoSerializable<org.tribuo.math.protos.NormalizerProto>
- Returns:
- The protobuf.
-
normalize
public double[] normalize(double[] input) Description copied from interface:VectorNormalizer
Normalizes the input array in some fashion specified by the class.- Specified by:
normalize
in interfaceVectorNormalizer
- Parameters:
input
- The input to normalize.- Returns:
- The normalized array.
-
normalizeInPlace
public void normalizeInPlace(double[] input) Description copied from interface:VectorNormalizer
In place normalization of the array.Note: This default implementation performs a copy by calling the standard normalize method.
- Specified by:
normalizeInPlace
in interfaceVectorNormalizer
- Parameters:
input
- The input to normalize.
-
exportNormalizer
Applies ONNX ReduceMin, Sub, ReduceSum, and Div operations to input.- Specified by:
exportNormalizer
in interfaceVectorNormalizer
- Parameters:
input
- The node to be normalized according to this implementation.- Returns:
- the node representing Div, the final applie operation.
-
equals
-
hashCode
public int hashCode()
-