public class EuclideanDistance extends FunctionMetric
Euclidean Distance between two lists of objects.
The MetricDataset needs to use an indexed list instead of an ordered one.double arrays, then they can be processed as is, without using the metric objects.
The desired result is a smaller distance, but you can use the isBetter() method to determine
what value is better. Null can be returned for invalid data.config, mathCompare, valueType| Constructor and Description |
|---|
EuclideanDistance()
Create a new instance of EuclideanDistance.
|
EuclideanDistance(java.lang.String thisValueType)
Create a new instance of EuclideanDistance.
|
| Modifier and Type | Method and Description |
|---|---|
double |
evaluate(double[] ds1,
double[] ds2)
Evaluate the comparison between the two data lists and return the result.
|
ReplySet |
evaluate(MetricDataset ds1,
MetricDataset ds2)
Evaluate the comparison between the two data lists and return the result.
|
protected void |
initialise()
Initialise the function values, setting the config parameters or other.
|
boolean |
isBetter(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
Return true if value2 is better than value1, as determined by the measurements of
this evaluation function.
|
FunctionMetric |
newInstance()
Create and return a new instance of the function, initialised with this function's
value type
valueType and mathOperation evaluator mathCompare. |
boolean |
sib()
Return true if a smaller distance between the two vectors is better.
|
evaluateCompare, libcheckValueType, createFunction, createFunction, createFunction, evaluate, getConfigParams, innerObject, isLegalNumber, setConfigParams, setEvaluator, setValueTypepublic EuclideanDistance()
throws java.lang.Exception
java.lang.Exception - any error.public EuclideanDistance(java.lang.String thisValueType)
throws java.lang.Exception
thisValueType - the type of object being evaluated.java.lang.Exception - any error.protected void initialise()
throws java.lang.Exception
initialise in class Functionjava.lang.Exception - any error.public ReplySet evaluate(MetricDataset ds1, MetricDataset ds2) throws java.lang.Exception
evaluate in interface FunctionMetricDefevaluate in class FunctionMetricds1 - first value dataset.ds2 - second value dataset.java.lang.Exception - any error.public double evaluate(double[] ds1,
double[] ds2)
throws java.lang.Exception
ds1 - first value dataset.ds2 - second value dataset.java.lang.Exception - any error.public boolean isBetter(java.lang.String valueType,
java.lang.Object value1,
java.lang.Object value2)
throws java.lang.Exception
isBetter in class FunctionMetricvalueType - the java type of the values to be evaluated.value1 - the first value type.value2 - the second value type.java.lang.Exception - any error.public boolean sib()
sib in class FunctionMetricpublic FunctionMetric newInstance() throws java.lang.Exception
valueType and mathOperation evaluator mathCompare.newInstance in class FunctionMetricjava.lang.Exception - any error.