Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.normalization
Class AttributeWiseRealVectorNormalization<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.AttributeWiseRealVectorNormalization<V>
All Implemented Interfaces:
Loggable, Normalization<V>, Parameterizable

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

Class to perform and undo a normalization on real vectors with respect to given minimum and maximum in each dimension.

Author:
Elke Achtert

Field Summary
private  double[] maxima
          Stores the maximum in each dimension.
static String MAXIMA_D
          Description for parameter minima.
static String MAXIMA_P
          Parameter for maxima.
private  double[] minima
          Stores the minimum in each dimension.
static String MINIMA_D
          Description for parameter minima.
static String MINIMA_P
          Parameter for minima.
 
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
 
Constructor Summary
AttributeWiseRealVectorNormalization()
          Sets minima and maxima parameter to the optionhandler.
 
Method Summary
 String description()
          Returns a description of the class and the required parameters.
private  void determineMinMax(List<ObjectAndAssociations<V>> objectAndAssociationsList)
          Determines the minima and maxima values in each dimension of the given featureVectors.
private  void determineMinMax(V[] featureVectors)
          Determines the minima and maxima values in each dimension of the given featureVectors.
private  double factor(int dimension)
          Returns a factor for normalization in a certain dimension.
 List<AttributeSettings> getAttributeSettings()
          Returns the settings of all options assigned to the option handler.
private  void initMinMax(int dimensionality)
          Initializes the min and max array.
 List<V> normalize(List<V> featureVectors)
          Performs a normalization on a set of feature vectors.
 List<ObjectAndAssociations<V>> normalizeObjects(List<ObjectAndAssociations<V>> objectAndAssociationsList)
          Performs a normalization on a list of database objects and their associations.
 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.
 String[] setParameters(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.
private  void updateMinMax(V featureVector)
          Updates the min and max array according to the specified feature vector.
 
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, checkGlobalParameterConstraints, deleteOption, description, description, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, setParameters
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, 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, getParameters, getPossibleOptions, inlineDescription
 

Field Detail

MINIMA_P

public static final String MINIMA_P
Parameter for minima.

See Also:
Constant Field Values

MINIMA_D

public static final String MINIMA_D
Description for parameter minima.

See Also:
Constant Field Values

MAXIMA_P

public static final String MAXIMA_P
Parameter for maxima.

See Also:
Constant Field Values

MAXIMA_D

public static final String MAXIMA_D
Description for parameter minima.

See Also:
Constant Field Values

maxima

private double[] maxima
Stores the maximum in each dimension.


minima

private double[] minima
Stores the minimum in each dimension.

Constructor Detail

AttributeWiseRealVectorNormalization

public AttributeWiseRealVectorNormalization()
Sets minima and maxima parameter to the optionhandler.

Method Detail

normalizeObjects

public List<ObjectAndAssociations<V>> normalizeObjects(List<ObjectAndAssociations<V>> 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
See Also:
Normalization.normalizeObjects(java.util.List)

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
See Also:
Normalization.normalize(java.util.List)

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
See Also:
Normalization.restore(de.lmu.ifi.dbs.elki.data.DatabaseObject)

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
See Also:
Normalization.restore(java.util.List)

transform

public LinearEquationSystem transform(LinearEquationSystem linearEquationSystem)
                               throws NonNumericFeaturesException
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
Throws:
NonNumericFeaturesException - if specified linear equation system is not compatible with values initialized during normalization
See Also:
Normalization.transform(de.lmu.ifi.dbs.elki.math.linearalgebra.LinearEquationSystem)

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

description

public String description()
Returns a description of the class and the required parameters.

This description should be suitable for a usage description.

Specified by:
description in interface Parameterizable
Overrides:
description in class AbstractParameterizable
Returns:
String a description of the class and the required parameters
See Also:
Parameterizable.description()

setParameters

public String[] setParameters(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
See Also:
Parameterizable.setParameters(String[])

getAttributeSettings

public List<AttributeSettings> getAttributeSettings()
Description copied from class: AbstractParameterizable
Returns the settings of all options assigned to the option handler.

Specified by:
getAttributeSettings in interface Parameterizable
Overrides:
getAttributeSettings in class AbstractParameterizable
Returns:
the setting of the attributes of the parameterizable
See Also:
Parameterizable.getAttributeSettings()

factor

private double factor(int dimension)
Returns a factor for normalization in a certain dimension.

The provided factor is the maximum-minimum in the specified dimension, if these two values differ, otherwise it is the maximum if this value differs from 0, otherwise it is 1.

Parameters:
dimension - the dimension to get a factor for normalization
Returns:
a factor for normalization in a certain dimension

determineMinMax

private void determineMinMax(V[] featureVectors)
Determines the minima and maxima values in each dimension of the given featureVectors.

Parameters:
featureVectors - the list of feature vectors

determineMinMax

private void determineMinMax(List<ObjectAndAssociations<V>> objectAndAssociationsList)
Determines the minima and maxima values in each dimension of the given featureVectors.

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

initMinMax

private void initMinMax(int dimensionality)
Initializes the min and max array.

Parameters:
dimensionality - the dimensionality of the feature vectors to be normalized

updateMinMax

private void updateMinMax(V featureVector)
Updates the min and max array according to the specified feature vector.

Parameters:
featureVector - the feature vector

Release 0.1 (2008-07-10_1838)