public abstract class NearnessMeasure extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
NearnessMeasure.Measurer
A calculator of "nearness".
|
Constructor and Description |
---|
NearnessMeasure() |
Modifier and Type | Method and Description |
---|---|
static NearnessMeasure |
cosine()
Measures nearness using cosine similarity.
|
static NearnessMeasure |
euclidean()
Measures nearness using Euclidean distance.
|
abstract double |
nearnessToDistance(double n)
Converts a "nearness" value to a "real" distance.
|
abstract NearnessMeasure.Measurer |
newMeasurer()
Creates a new measurer for use.
|
public abstract NearnessMeasure.Measurer newMeasurer()
public abstract double nearnessToDistance(double n)
For example, in Euclidean distance, a square root is required to obtain the actual distance. However, the squared distance provides exactly the same ordering as the true distance, so can be used as the "nearness". If the true distance is required, it can be derived on an as needed basis.
n
- the "nearness" value returned by a measurerpublic static NearnessMeasure cosine()
Results in the range [0,-1] have no clear interpretation of "nearness". In this implementation, 0 is arbitrarily considered "nearer" than -1. Due to this ambiguity, this measure is best used when the values of features are non-negative, ensuring results in the range [1,0] for which the interpretation of "nearer" is clear.
public static NearnessMeasure euclidean()
Copyright © 2019 Actian Corporation. All rights reserved.