Class ExpNormalizer

java.lang.Object
org.tribuo.math.util.ExpNormalizer
All Implemented Interfaces:
Serializable, VectorNormalizer, ProtoSerializable<org.tribuo.math.protos.NormalizerProto>

public class ExpNormalizer extends Object implements VectorNormalizer, Serializable
Normalizes the exponential values of the input array. Used when the input is in log space.

a.k.a. SoftMax.

See Also:
  • Field Details

    • CURRENT_VERSION

      public static final int CURRENT_VERSION
      Protobuf serialization version.
      See Also:
  • Constructor Details

    • ExpNormalizer

      public ExpNormalizer()
      Constructs an ExpNormalizer.
  • Method Details

    • deserializeFromProto

      public static ExpNormalizer 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 interface ProtoSerializable<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 interface VectorNormalizer
      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 interface VectorNormalizer
      Parameters:
      input - The input to normalize.
    • exportNormalizer

      public ONNXNode exportNormalizer(ONNXNode input)
      Returns the ONNX softmax node over the 2nd dimension.
      Specified by:
      exportNormalizer in interface VectorNormalizer
      Parameters:
      input - The node to be normalized according to this implementation.
      Returns:
      ONNX softmax node of input.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object