smile.math.distance
Class SparseEuclideanDistance
- java.lang.Object
-
- smile.math.distance.SparseEuclideanDistance
-
- All Implemented Interfaces:
- java.io.Serializable, Distance<SparseArray>, Metric<SparseArray>
public class SparseEuclideanDistance extends java.lang.Object implements Metric<SparseArray>, java.io.Serializable
Euclidean distance. Use getInstance() to get the standard unweighted Euclidean distance. Or create an instance with a specified weight vector. For float or double arrays, missing values (i.e. NaN) are also handled. Also support sparse arrays of which zeros are excluded to save space.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SparseEuclideanDistance()Constructor.SparseEuclideanDistance(double[] weight)Constructor with a given weight vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubled(SparseArray x, SparseArray y)Returns the distance measure between two objects.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SparseEuclideanDistance
public SparseEuclideanDistance()
Constructor. Standard (unweighted) Euclidean distance.
-
SparseEuclideanDistance
public SparseEuclideanDistance(double[] weight)
Constructor with a given weight vector.- Parameters:
weight- the weight vector.
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
d
public double d(SparseArray x, SparseArray y)
Description copied from interface:DistanceReturns the distance measure between two objects.- Specified by:
din interfaceDistance<SparseArray>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG