org.knime.base.data.normalize
Class Normalizer

java.lang.Object
  extended by org.knime.base.data.normalize.Normalizer

public final class Normalizer
extends Object

A wrapper table to normalize all DataRows. Three methods of normalization are available:

Important ! Be sure to pull a new DataTableSpec with generateNewSpec(DataTableSpec, String[]), because IntCell columns are converted to DoubleCell columns.

Author:
Nicolas Cebron, University of Konstanz

Constructor Summary
Normalizer(BufferedDataTable table, String[] columns)
          Prepares a Normalizer to process the buffered data table table.
Normalizer(StatisticsTable table, String[] columns)
          Prepares a Normalizer to process the StatisticsTable table (actually no traversing is done here).
 
Method Summary
 AffineTransTable doDecimalScaling(ExecutionMonitor exec)
          Does the decimal scaling.
 AffineTransTable doMinMaxNorm(double newmax, double newmin, ExecutionMonitor exec)
          Does the Min-Max Normalization.
 AffineTransTable doZScoreNorm(ExecutionMonitor exec)
          Does the Z-Score Normalization.
static DataTableSpec generateNewSpec(DataTableSpec inspec, String[] columns)
          Creates a new DataTableSpec.
 String getErrorMessage()
           
(package private)  void setErrorMessage(String message)
          Sets an error message, if something went wrong during initialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Normalizer

public Normalizer(BufferedDataTable table,
                  String[] columns)
Prepares a Normalizer to process the buffered data table table. Only columns as contained in the array argument are considered.

Parameters:
table - table to be wrapped
columns - to work on
See Also:
DataTable.getDataTableSpec()

Normalizer

public Normalizer(StatisticsTable table,
                  String[] columns)
Prepares a Normalizer to process the StatisticsTable table (actually no traversing is done here).

Parameters:
table - table to be wrapped
columns - to work on
See Also:
DataTable.getDataTableSpec()
Method Detail

generateNewSpec

public static final DataTableSpec generateNewSpec(DataTableSpec inspec,
                                                  String[] columns)
Creates a new DataTableSpec. IntCell-columns are converted to DoubleCell-columns.

Parameters:
inspec - the DataTableSpec of the input table
columns - the columns that are normalized
Returns:
DataTableSpec for the output table

doMinMaxNorm

public AffineTransTable doMinMaxNorm(double newmax,
                                     double newmin,
                                     ExecutionMonitor exec)
                              throws CanceledExecutionException
Does the Min-Max Normalization.

Parameters:
newmax - the new maximum
newmin - the new minimum
exec - an object to check for user cancelations. Can be null.
Returns:
normalized DataTable
Throws:
CanceledExecutionException - if user canceled

doZScoreNorm

public AffineTransTable doZScoreNorm(ExecutionMonitor exec)
                              throws CanceledExecutionException
Does the Z-Score Normalization.

Parameters:
exec - an object to check for user cancelations. Can be null.
Returns:
the normalized DataTable
Throws:
CanceledExecutionException - if user canceled

doDecimalScaling

public AffineTransTable doDecimalScaling(ExecutionMonitor exec)
                                  throws CanceledExecutionException
Does the decimal scaling.

Parameters:
exec - an object to check for user cancelations. Can be null.
Returns:
the normalized DataTable
Throws:
CanceledExecutionException - if user canceled

setErrorMessage

void setErrorMessage(String message)
Sets an error message, if something went wrong during initialization.

Parameters:
message - the message to set.

getErrorMessage

public String getErrorMessage()
Returns:
error message if something went wrong, null otherwise.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.