public class JaccardCoefficient extends FunctionMetric
Jaccard Coefficient
evaluation.
The MetricDataset
needs to use an indexed list instead of an ordered one.String arrays
, then they can be processed as is, without using the metric objects.
The desired result is a larger distance in the range 0 to 1, 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 |
---|
JaccardCoefficient()
Create a new instance of JaccardCoefficient.
|
JaccardCoefficient(java.lang.String thisValueType)
Create a new instance of JaccardCoefficient.
|
Modifier and Type | Method and Description |
---|---|
ReplySet |
evaluate(MetricDataset ds1,
MetricDataset ds2)
Evaluate the comparison between the two data lists and return the result.
|
double |
evaluate(java.lang.String[] ds1,
java.lang.String[] 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, lib
checkValueType, createFunction, createFunction, createFunction, evaluate, getConfigParams, innerObject, isLegalNumber, setConfigParams, setEvaluator, setValueType
public JaccardCoefficient() throws java.lang.Exception
java.lang.Exception
- any error.public JaccardCoefficient(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 Function
java.lang.Exception
- any error.public ReplySet evaluate(MetricDataset ds1, MetricDataset ds2) throws java.lang.Exception
evaluate
in interface FunctionMetricDef
evaluate
in class FunctionMetric
ds1
- first value dataset.ds2
- second value dataset.java.lang.Exception
- any error.public double evaluate(java.lang.String[] ds1, java.lang.String[] 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 FunctionMetric
valueType
- 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 FunctionMetric
public FunctionMetric newInstance() throws java.lang.Exception
valueType
and mathOperation evaluator mathCompare
.newInstance
in class FunctionMetric
java.lang.Exception
- any error.