Class Linear

java.lang.Object
org.tribuo.math.kernel.Linear
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, Kernel, ProtoSerializable<org.tribuo.math.protos.KernelProto>

public class Linear extends Object implements Kernel
A linear kernel, u.dot(v).
See Also:
  • Field Details

    • CURRENT_VERSION

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

    • Linear

      public Linear()
      A linear kernel, u.dot(v).
  • Method Details

    • deserializeFromProto

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

      public double similarity(SparseVector a, SparseVector b)
      Description copied from interface: Kernel
      Calculates the similarity between two SparseVectors.
      Specified by:
      similarity in interface Kernel
      Parameters:
      a - The first SparseVector.
      b - The second SparseVector.
      Returns:
      A value between 0 and 1, where 1 is most similar and 0 is least similar.
    • toString

      public String toString()
      Overrides:
      toString 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>
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object