at.tuwien.ifs.somtoolbox.layers.metrics
Class MissingValueMetricWrapper

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
      extended by at.tuwien.ifs.somtoolbox.layers.metrics.MissingValueMetricWrapper
All Implemented Interfaces:
DistanceMetric, Comparable<DistanceMetric>

public class MissingValueMetricWrapper
extends AbstractMetric

A wrapper class around other distance metrics, modifying the distance computation in such a way that only vector attributes that are not missing (indicated by InputData.MISSING_VALUE are considered.
When instantiating using the empty constructor MissingValueMetricWrapper() the default metric DEFAULT_METRIC is used.

Version:
$Id: MissingValueMetricWrapper.java 3583 2010-05-21 10:07:41Z mayer $
Author:
Rudolf Mayer

Nested Class Summary
 
Nested classes/interfaces inherited from interface at.tuwien.ifs.somtoolbox.layers.metrics.DistanceMetric
DistanceMetric.SparcseMetricModes
 
Field Summary
private static L2Metric DEFAULT_METRIC
           
private  DistanceMetric metric
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
PACKAGE_NAME
 
Constructor Summary
MissingValueMetricWrapper()
           
MissingValueMetricWrapper(DistanceMetric metric)
           
 
Method Summary
 double distance(double[] vector1, double[] vector2)
          Calculates the distance between two vectors provided by argument vector1 and vector2.
 void setMetric(DistanceMetric metric)
           
 void setMetricParams(String metricParamString)
          Empty implementation, subclasses needing to set parameters have to override this class.
 
Methods inherited from class at.tuwien.ifs.somtoolbox.layers.metrics.AbstractMetric
checkDimensions, checkDimensions, compareTo, distance, distance, distance, distance, distance, distance, distance, distance, instantiate, instantiateNice, meanVector, performanceTest, transformValue, transformVector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_METRIC

private static final L2Metric DEFAULT_METRIC

metric

private DistanceMetric metric
Constructor Detail

MissingValueMetricWrapper

public MissingValueMetricWrapper()

MissingValueMetricWrapper

public MissingValueMetricWrapper(DistanceMetric metric)
Method Detail

distance

public double distance(double[] vector1,
                       double[] vector2)
                throws MetricException
Description copied from interface: DistanceMetric
Calculates the distance between two vectors provided by argument vector1 and vector2. A MetricException is thrown, if the dimensionalities of the two vectors differ.

Specified by:
distance in interface DistanceMetric
Specified by:
distance in class AbstractMetric
Parameters:
vector1 - first vector.
vector2 - second vector.
Returns:
the distance between vector1 and vector2.
Throws:
MetricException - if the dimensionalities of the two vectors differ.
See Also:
DistanceMetric.distance(double[], double[])

setMetricParams

public void setMetricParams(String metricParamString)
                     throws SOMToolboxException
Description copied from class: AbstractMetric
Empty implementation, subclasses needing to set parameters have to override this class.

Specified by:
setMetricParams in interface DistanceMetric
Overrides:
setMetricParams in class AbstractMetric
Throws:
SOMToolboxException

setMetric

public void setMetric(DistanceMetric metric)