|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.matrix.CosineDistance
public class CosineDistance
The CosineDistance class implements proximity as
vector cosine. Distance is defined as one minus the proximity.
The vector cosine operation is defined in the vector interface,
Vector.cosine(Vector)
| Field Summary | |
|---|---|
static CosineDistance |
DISTANCE
A constant for the cosine distance. |
| Constructor Summary | |
|---|---|
CosineDistance()
Construct a cosine proximity. |
|
| Method Summary | |
|---|---|
double |
distance(Vector v1,
Vector v2)
Returns one minus the proximity of the vectors. |
double |
proximity(Vector v1,
Vector v2)
Returns the cosine between the specified vectors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final CosineDistance DISTANCE
| Constructor Detail |
|---|
public CosineDistance()
| Method Detail |
|---|
public double distance(Vector v1,
Vector v2)
distance(v1,v2) = 1.0 - proximity(v1,v2)
With this definition, distances run between 0 and 2,
with identical vectors being at distance 0, orthogonal
vectors at distance 1 and oppositive vectors at distance 2.
v1 - First vector.v2 - Second vector.
public double proximity(Vector v1,
Vector v2)
proximity in interface Proximity<Vector>v1 - First vector.v2 - Second vector.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||