Enum Index.SpaceType

java.lang.Object
java.lang.Enum<Index.SpaceType>
com.spotify.voyager.jni.Index.SpaceType
All Implemented Interfaces:
Serializable, Comparable<Index.SpaceType>
Enclosing class:
Index

public static enum Index.SpaceType extends Enum<Index.SpaceType>
The space, also known as distance metric, to use when searching.

SpaceType is a property of an Index, and cannot be changed after instantiation. Loading an index with a different SpaceType than it was created with may result in nonsensical results being returned.

  • Enum Constant Details

    • Euclidean

      public static final Index.SpaceType Euclidean
      Euclidean distance, also known as L2 distance. Computed by taking the square root of the sum of squared differences between each element of each vector.
    • InnerProduct

      public static final Index.SpaceType InnerProduct
      Inner (dot) product. Computed by taking the sum of the products of each element of each vector. Since v2.0, this is implemented using the order preserving transform defined in this paper from Microsoft: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/XboxInnerProduct.pdf
    • Cosine

      public static final Index.SpaceType Cosine
      Cosine distance; i.e. normalized dot product. Computed by taking the sum of the products of each element of each vector, divided by the product of the magnitudes of each vector.
  • Method Details

    • values

      public static Index.SpaceType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Index.SpaceType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null