Package org.tribuo.math.util
Interface VectorNormalizer
- All Superinterfaces:
ProtoSerializable<org.tribuo.math.protos.NormalizerProto>
,Serializable
- All Known Implementing Classes:
ExpNormalizer
,NoopNormalizer
,Normalizer
,SigmoidNormalizer
public interface VectorNormalizer
extends ProtoSerializable<org.tribuo.math.protos.NormalizerProto>, Serializable
A functional interface that generates a normalized version of a double array.
-
Field Summary
Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Method Summary
Modifier and TypeMethodDescriptionstatic VectorNormalizer
deserialize
(org.tribuo.math.protos.NormalizerProto proto) Deserializes the vector normalizer from the supplied protobuf.default ONNXNode
exportNormalizer
(ONNXNode input) Exports this normalizer to ONNX, returning the leaf of the appended graph and writing the nodes needed for normalization into theONNXContext
thatinput
belongs to.double[]
normalize
(double[] input) Normalizes the input array in some fashion specified by the class.default void
normalizeInPlace
(double[] input) In place normalization of the array.Methods inherited from interface org.tribuo.protos.ProtoSerializable
serialize
-
Method Details
-
normalize
double[] normalize(double[] input) Normalizes the input array in some fashion specified by the class.- Parameters:
input
- The input to normalize.- Returns:
- The normalized array.
-
normalizeInPlace
default void normalizeInPlace(double[] input) In place normalization of the array.Note: This default implementation performs a copy by calling the standard normalize method.
- Parameters:
input
- The input to normalize.
-
exportNormalizer
Exports this normalizer to ONNX, returning the leaf of the appended graph and writing the nodes needed for normalization into theONNXContext
thatinput
belongs to.For compatibility reasons this method has a default implementation, though when called it will throw an
IllegalStateException
. In a future version this method will not have a default implementation and normalizers will be required to provide ONNX support.- Parameters:
input
- The node to be normalized according to this implementation.- Returns:
- The leaf node of the graph of operations added to normalize input.
-
deserialize
Deserializes the vector normalizer from the supplied protobuf.- Parameters:
proto
- The protobuf to deserialize.- Returns:
- The normalizer.
-