Class L2Distance

java.lang.Object
org.tribuo.math.distance.L2Distance
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, Distance, ProtoSerializable<org.tribuo.math.protos.DistanceProto>

public final class L2Distance extends Object implements Distance
L2 (or Euclidean) distance.
See Also:
  • Field Details

    • CURRENT_VERSION

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

    • L2Distance

      public L2Distance()
      Constructs an L2 distance function.
  • Method Details

    • deserializeFromProto

      public static L2Distance 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.DistanceProto serialize()
      Description copied from interface: ProtoSerializable
      Serializes this object to a protobuf.
      Specified by:
      serialize in interface ProtoSerializable<org.tribuo.math.protos.DistanceProto>
      Returns:
      The protobuf.
    • computeDistance

      public double computeDistance(SGDVector first, SGDVector second)
      Description copied from interface: Distance
      Computes the distance between the two vectors.
      Specified by:
      computeDistance in interface Distance
      Parameters:
      first - The first vector.
      second - The second vector.
      Returns:
      The distance between them.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getProvenance

      public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>