com.rapidminer.tools.math.similarity
Class DistanceMeasure

java.lang.Object
  extended by com.rapidminer.tools.math.similarity.DistanceMeasure
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BregmanDivergence, CamberraNumericalDistance, ChebychevNumericalDistance, DTWDistance, EuclideanDistance, KernelEuclideanDistance, ManhattanDistance, MixedEuclideanDistance, NominalDistance, SimilarityMeasure

public abstract class DistanceMeasure
extends java.lang.Object
implements java.io.Serializable

This interfaces defines the methods for all similarity measures. Classes implementing this interface are not allowed to have a constructer, instead should use the init method.

Author:
Sebastian Land
See Also:
Serialized Form

Constructor Summary
DistanceMeasure()
           
 
Method Summary
abstract  double calculateDistance(double[] value1, double[] value2)
          This method does the calculation of the distance between two double arrays.
 double calculateDistance(Example firstExample, double[] second)
          This is a convinient method for calculating the distance between examples and double arrays.
 double calculateDistance(Example firstExample, Example secondExample)
          This is a convinient method for calculating the distance between examples.
abstract  double calculateSimilarity(double[] value1, double[] value2)
          This method does the similarity of the distance between two double arrays.
 double calculateSimilarity(Example firstExample, double[] second)
          This is a convinient method for calculating the similarity between examples and a double array.
 double calculateSimilarity(Example firstExample, Example secondExample)
          This is a convinient method for calculating the similarity between examples.
abstract  void init(ExampleSet exampleSet)
          Before using a similarity measure, it is needed to initialise.
 void init(ExampleSet exampleSet, ParameterHandler parameterHandler)
          Before using a similarity measure, it is needed to initialise.
 void init(ExampleSet exampleSet, ParameterHandler parameterHandler, IOContainer ioContainer)
          Before using a similarity measure, it is needed to initialize.
 boolean isDistance()
          This method returns a boolean wheter this measure is a distance measure
 boolean isSimilarity()
          This method returns a boolean wheter this measure is a similarity measure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistanceMeasure

public DistanceMeasure()
Method Detail

init

public abstract void init(ExampleSet exampleSet)
                   throws OperatorException
Before using a similarity measure, it is needed to initialise. Subclasses might use initialising for remembering the exampleset properties like attribute type or test if applicable to exampleSet at all. Please note that it might be necessary to also override the other init methods if this measrue should make use of parameters or other IOObjects.

Parameters:
exampleSet - the exampleset
Throws:
OperatorException

init

public void init(ExampleSet exampleSet,
                 ParameterHandler parameterHandler)
          throws OperatorException
Before using a similarity measure, it is needed to initialise. Subclasses might use initialising for remembering the exampleset properties like attribute type or test if applicable to exampleSet at all. This init method calles init(exampleSet) per default and ignores parameterHandler. Subclasses might use the parameterHandler to evaluate parameter settings.

Parameters:
exampleSet - the exampleset
parameterHandler - the handler to ask for parameter values
Throws:
OperatorException

init

public void init(ExampleSet exampleSet,
                 ParameterHandler parameterHandler,
                 IOContainer ioContainer)
          throws OperatorException
Before using a similarity measure, it is needed to initialize. Subclasses might use initializing for remembering the exampleset properties like attribute type or test if applicable to exampleSet at all. This init method calles init(exampleSet) per default and ignores the parameterHandler and the ioContainer. Subclasses might use the parameterHandler to evaluate parameter settings and the IOContainer to access other objects.

Parameters:
exampleSet - the exampleset
parameterHandler - the handler to ask for parameter values
ioContainer - the container holding the additional IO objects
Throws:
OperatorException

calculateDistance

public abstract double calculateDistance(double[] value1,
                                         double[] value2)
This method does the calculation of the distance between two double arrays. The meanings of the double values might be remembered from the init method.

Parameters:
value1 -
value2 -
Returns:
the distance

calculateSimilarity

public abstract double calculateSimilarity(double[] value1,
                                           double[] value2)
This method does the similarity of the distance between two double arrays. The meanings of the double values might be remembered from the init method.

Parameters:
value1 -
value2 -
Returns:
the distance

isDistance

public boolean isDistance()
This method returns a boolean wheter this measure is a distance measure

Returns:
true if is distance

isSimilarity

public final boolean isSimilarity()
This method returns a boolean wheter this measure is a similarity measure

Returns:
true if is similarity

calculateDistance

public double calculateDistance(Example firstExample,
                                Example secondExample)
This is a convinient method for calculating the distance between examples. All attributes will be used to form a double array, used for the calculateDistance method.

Returns:
the distance

calculateDistance

public final double calculateDistance(Example firstExample,
                                      double[] second)
This is a convinient method for calculating the distance between examples and double arrays. All attributes will be used to form a double array, used for the calculateDistance method.

Returns:
the distance

calculateSimilarity

public double calculateSimilarity(Example firstExample,
                                  Example secondExample)
This is a convinient method for calculating the similarity between examples. All attributes will be used to form a double array, used for the calculateDistance method.

Returns:
the distance

calculateSimilarity

public final double calculateSimilarity(Example firstExample,
                                        double[] second)
This is a convinient method for calculating the similarity between examples and a double array. All attributes will be used to form a double array, used for the calculateDistance method.

Returns:
the distance


Copyright © 2001-2009 by Rapid-I