Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.normalization
Class AttributeWiseVarianceNormalization<V extends RealVector<V,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.normalization.AbstractNormalization<V>
              extended by de.lmu.ifi.dbs.elki.normalization.AttributeWiseVarianceNormalization<V>
Type Parameters:
V - vector type
All Implemented Interfaces:
Normalization<V>, Parameterizable

public class AttributeWiseVarianceNormalization<V extends RealVector<V,?>>
extends AbstractNormalization<V>

Class to perform and undo a normalization on real vectors with respect to given mean and standard deviation in each dimension.

Author:
Erich Schubert

Field Summary
private  double[] mean
          Stores the mean in each dimension.
static OptionID MEAN_ID
          OptionID for MEAN_PARAM
private  DoubleListParameter MEAN_PARAM
          Parameter for means.
private  double[] stddev
          Stores the standard deviation in each dimension.
static OptionID STDDEV_ID
          OptionID for STDDEV_PARAM
private  DoubleListParameter STDDEV_PARAM
          Parameter for stddevs.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
AttributeWiseVarianceNormalization()
          Sets mean and stddev parameter to the optionhandler.
 
Method Summary
private  void determineMeanVariance(List<Pair<V,Associations>> objectAndAssociationsList)
          Determines the means and standard deviations in each dimension of the given featureVectors.
private  void determineMeanVariance(V[] featureVectors)
          Determines the mean and standard deviations in each dimension of the given featureVectors.
private  double normalize(int d, double val)
           
 List<V> normalize(List<V> featureVectors)
          Performs a normalization on a set of feature vectors.
 List<Pair<V,Associations>> normalizeObjects(List<Pair<V,Associations>> objectAndAssociationsList)
          Performs a normalization on a list of database objects and their associations.
private  double restore(int d, double val)
           
 List<V> restore(List<V> featureVectors)
          Transforms a set of feature vectores to the original attribute ranges.
 V restore(V featureVector)
          Transforms a feature vector to the original attribute ranges.
 List<String> setParameters(List<String> args)
          Sets the attributes of the class accordingly to the given parameters.
 String toString(String pre)
          Returns a string representation of this normalization.
 LinearEquationSystem transform(LinearEquationSystem linearEquationSystem)
          Transforms a linear equation system describing linear dependencies derived on the normalized space into a linear equation system describing linear dependencies quantitatively adapted to the original space.
 
Methods inherited from class de.lmu.ifi.dbs.elki.normalization.AbstractNormalization
toString
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable, shortDescription
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, collectOptions, getParameters, shortDescription
 

Field Detail

MEAN_ID

public static final OptionID MEAN_ID
OptionID for MEAN_PARAM


STDDEV_ID

public static final OptionID STDDEV_ID
OptionID for STDDEV_PARAM


MEAN_PARAM

private final DoubleListParameter MEAN_PARAM
Parameter for means.


STDDEV_PARAM

private final DoubleListParameter STDDEV_PARAM
Parameter for stddevs.


mean

private double[] mean
Stores the mean in each dimension.


stddev

private double[] stddev
Stores the standard deviation in each dimension.

Constructor Detail

AttributeWiseVarianceNormalization

public AttributeWiseVarianceNormalization()
Sets mean and stddev parameter to the optionhandler.

Method Detail

normalize

private double normalize(int d,
                         double val)

restore

private double restore(int d,
                       double val)

normalizeObjects

public List<Pair<V,Associations>> normalizeObjects(List<Pair<V,Associations>> objectAndAssociationsList)
                                                                    throws NonNumericFeaturesException
Description copied from interface: Normalization
Performs a normalization on a list of database objects and their associations.

Parameters:
objectAndAssociationsList - the list of database objects and their associations
Returns:
a list of normalized database objects and their associations corresponding to the given list
Throws:
NonNumericFeaturesException - if feature vectors differ in length or values are not suitable to normalization

normalize

public List<V> normalize(List<V> featureVectors)
                                          throws NonNumericFeaturesException
Description copied from interface: Normalization
Performs a normalization on a set of feature vectors.

Parameters:
featureVectors - a set of feature vectors to be normalized
Returns:
a set of normalized feature vectors corresponding to the given feature vectors but being different objects
Throws:
NonNumericFeaturesException - if feature vectors differ in length or values are not suitable to normalization

restore

public V restore(V featureVector)
                                  throws NonNumericFeaturesException
Description copied from interface: Normalization
Transforms a feature vector to the original attribute ranges.

Parameters:
featureVector - a feature vector to be transformed into original space
Returns:
a feature vector transformed into original space corresponding to the given feature vector
Throws:
NonNumericFeaturesException - feature vector is not compatible with values initialized during normalization

restore

public List<V> restore(List<V> featureVectors)
                                        throws NonNumericFeaturesException
Description copied from interface: Normalization
Transforms a set of feature vectores to the original attribute ranges.

Parameters:
featureVectors - a set of feature vectors to be transformed into original space
Returns:
a set of feature vectors transformed into original space corresponding to the given feature vectors
Throws:
NonNumericFeaturesException - if feature vectors differ in length or are not compatible with values initialized during normalization

transform

public LinearEquationSystem transform(LinearEquationSystem linearEquationSystem)
Description copied from interface: Normalization
Transforms a linear equation system describing linear dependencies derived on the normalized space into a linear equation system describing linear dependencies quantitatively adapted to the original space.

Parameters:
linearEquationSystem - the linear equation system to be transformed
Returns:
a linear equation system describing linear dependencies derived on the normalized space transformed into a linear equation system describing linear dependencies quantitatively adapted to the original space

toString

public String toString(String pre)
Returns a string representation of this normalization. The specified prefix pre will be the prefix of each new line. This method is used to write the parameters of a normalization to a result of an algorithm using this normalization.

Parameters:
pre - the prefix of each new line
Returns:
a string representation of this normalization

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Sets the attributes of the class accordingly to the given parameters. Returns a new String array containing those entries of the given array that are neither expected nor used by this Parameterizable.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractParameterizable
Parameters:
args - parameters to set the attributes accordingly to
Returns:
String[] an array containing the unused parameters
Throws:
IllegalArgumentException - in case of wrong parameter-setting
ParameterException - in case of wrong parameter-setting

determineMeanVariance

private void determineMeanVariance(V[] featureVectors)
Determines the mean and standard deviations in each dimension of the given featureVectors.

Parameters:
featureVectors - the list of feature vectors

determineMeanVariance

private void determineMeanVariance(List<Pair<V,Associations>> objectAndAssociationsList)
Determines the means and standard deviations in each dimension of the given featureVectors.

Parameters:
objectAndAssociationsList - the list of feature vectors and their associations

Release 0.2 (2009-07-06_1820)