Enum DistanceFunction
- java.lang.Object
-
- java.lang.Enum<DistanceFunction>
-
- com.microsoft.semantickernel.data.vectorstorage.definition.DistanceFunction
-
- All Implemented Interfaces:
Serializable,Comparable<DistanceFunction>
public enum DistanceFunction extends Enum<DistanceFunction>
Distance functions for vector storage.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description COSINE_DISTANCECosine distance function. 1 - cosine similarity.COSINE_SIMILARITYCosine (angular) similarity function.DOT_PRODUCTDot product between two vectors.EUCLIDEAN_DISTANCEEuclidean distance function.UNDEFINEDNo distance function specified.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetValue()Gets the function name.static DistanceFunctionvalueOf(String name)Returns the enum constant of this type with the specified name.static DistanceFunction[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
COSINE_SIMILARITY
public static final DistanceFunction COSINE_SIMILARITY
Cosine (angular) similarity function.
-
COSINE_DISTANCE
public static final DistanceFunction COSINE_DISTANCE
Cosine distance function. 1 - cosine similarity.
-
DOT_PRODUCT
public static final DistanceFunction DOT_PRODUCT
Dot product between two vectors.
-
EUCLIDEAN_DISTANCE
public static final DistanceFunction EUCLIDEAN_DISTANCE
Euclidean distance function. Also known as L2 distance.
-
UNDEFINED
public static final DistanceFunction UNDEFINED
No distance function specified. It will default to the database's default distance function.
-
-
Method Detail
-
values
public static DistanceFunction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DistanceFunction c : DistanceFunction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DistanceFunction 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 nameNullPointerException- if the argument is null
-
getValue
public String getValue()
Gets the function name.- Returns:
- The function name.
-
-