Class SparseManhattanDistance
java.lang.Object
smile.math.distance.SparseManhattanDistance
- All Implemented Interfaces:
Serializable, ToDoubleBiFunction<SparseArray, SparseArray>, Distance<SparseArray>, Metric<SparseArray>
Manhattan distance, also known as L1 distance or L1
norm, is the sum of the (absolute) differences of their coordinates.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubled(SparseArray x, SparseArray y) Returns the distance measure between two objects.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Distance
apply, applyAsDouble, pdist, pdist
-
Constructor Details
-
SparseManhattanDistance
public SparseManhattanDistance()Constructor. -
SparseManhattanDistance
public SparseManhattanDistance(double[] weight) Constructor.- Parameters:
weight- the weight vector.
-
-
Method Details
-
toString
-
d
Description copied from interface:DistanceReturns the distance measure between two objects.- Specified by:
din interfaceDistance<SparseArray>- Parameters:
x- an object.y- an object.- Returns:
- the distance.
-