public class L2 extends MetricUDF
It returns one of the tuples of the bag of vectors using L2 distance, distance between two vectors. This is otherwise known as the Euclidean distance.
L2PStableHash for an example
Constructor and Description |
---|
L2(java.lang.String sDim)
Create a new L2 Metric UDF with a given dimension.
|
Modifier and Type | Method and Description |
---|---|
protected double |
dist(org.apache.commons.math.linear.RealVector v1,
org.apache.commons.math.linear.RealVector v2)
The distance metric used.
|
static double |
distance(org.apache.commons.math.linear.RealVector v1,
org.apache.commons.math.linear.RealVector v2) |
exec, outputSchema
allowCompileTimeCalculation, finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, progress, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
public L2(java.lang.String sDim)
sDim
- dimensionpublic static double distance(org.apache.commons.math.linear.RealVector v1, org.apache.commons.math.linear.RealVector v2)
protected double dist(org.apache.commons.math.linear.RealVector v1, org.apache.commons.math.linear.RealVector v2)
MetricUDF