org.knime.base.data.normalize
Class AffineTransTable

java.lang.Object
  extended by org.knime.base.data.normalize.AffineTransTable
All Implemented Interfaces:
Iterable<DataRow>, DataTable

public class AffineTransTable
extends Object
implements DataTable

Table that performs an affine transformation, i.e. y = a*x + b where a and be b are parameters, x the input value and y the transformed output.

The transformation is only applied to a given set of (DoubleValue - compatible) columns. Other columns are copied.

Author:
Bernd Wiswedel, University of Konstanz

Field Summary
static double VERY_SMALL
          A very small number.
 
Constructor Summary
AffineTransTable(DataTable table, AffineTransConfiguration configuration)
          Creates new table, normalizing table with the configuration given by configuration.
AffineTransTable(DataTable table, String[] names, double[] scales, double[] translations, double[] min, double[] max)
          Deprecated. Create AffineTransConfiguration object and then use the constructor AffineTransTable(DataTable, AffineTransConfiguration).
 
Method Summary
static DataTableSpec createSpec(DataTableSpec spec, ModelContentRO settings)
          Reads the meta information from the settings object and constructs the DataTableSpec, which would be the outcome when a table complying with spec were fet to the load method.
 AffineTransConfiguration getConfiguration()
           
 DataTableSpec getDataTableSpec()
          Returns the DataTableSpec object of this table which gives information about the structure of this data table.
 String getErrorMessage()
           
(package private)  int[] getIndicesInConfiguration()
           
 RowIterator iterator()
          Returns a row iterator which returns each row one-by-one from the table.
static AffineTransTable load(DataTable table, ModelContentRO sets)
          Reads the meta information from the settings object and constructs a AffineTransTable based on this information and the given DataTable.
 void save(ModelContentWO settings)
          Saves internals to the argument settings object.
(package private)  void setErrorMessage(String message)
          Sets an error message, if something went wrong during normalization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERY_SMALL

public static final double VERY_SMALL
A very small number.

See Also:
Constant Field Values
Constructor Detail

AffineTransTable

@Deprecated
public AffineTransTable(DataTable table,
                                   String[] names,
                                   double[] scales,
                                   double[] translations,
                                   double[] min,
                                   double[] max)
Deprecated. Create AffineTransConfiguration object and then use the constructor AffineTransTable(DataTable, AffineTransConfiguration).

Creates new table given the following parameters.

Parameters:
table - the Table to wrap
names - the names of the column to scale
scales - the scale parameters (same order as names)
translations - the translation parameters
min - the minimum values (for sanity checks). If the normalized value is slightly off the desired minimum value because of rounding errors, it is set to this bounding value. Can be Double.NaN, then no checks are performed.
max - the maximum values (for sanity checks). If the normalized value is slightly off the desired maximum value because of rounding errors, it is set to this bounding value. Can be Double.NaN, then no checks are performed.
Throws:
NullPointerException - if any argument is null
IllegalArgumentException - if the arrays don't have the same length, the names are not contained in the spec, the double arrays of scales and translations contain NaN, the target columns are not DoubleValue compatible

AffineTransTable

public AffineTransTable(DataTable table,
                        AffineTransConfiguration configuration)
Creates new table, normalizing table with the configuration given by configuration.

Parameters:
table - To be normalized
configuration - Normalization parameters.
Throws:
NullPointerException - If either arg is null.
IllegalArgumentException - If target cols in table are not numeric.
Method Detail

getDataTableSpec

public DataTableSpec getDataTableSpec()
Returns the DataTableSpec object of this table which gives information about the structure of this data table.

Specified by:
getDataTableSpec in interface DataTable
Returns:
the DataTableSpec of this table

getConfiguration

public AffineTransConfiguration getConfiguration()
Returns:
the configuration

getIndicesInConfiguration

int[] getIndicesInConfiguration()
Returns:
the indicesInConfiguration

iterator

public RowIterator iterator()
Returns a row iterator which returns each row one-by-one from the table.

Specified by:
iterator in interface Iterable<DataRow>
Specified by:
iterator in interface DataTable
Returns:
row iterator
See Also:
DataRow

save

public void save(ModelContentWO settings)
Saves internals to the argument settings object. This object is supposed to be the only one writing to this (sub)setting object.

Parameters:
settings - To write to.

load

public static AffineTransTable load(DataTable table,
                                    ModelContentRO sets)
                             throws InvalidSettingsException
Reads the meta information from the settings object and constructs a AffineTransTable based on this information and the given DataTable.

Parameters:
table - The table to which the normalization is applied.
sets - The normalization information.
Returns:
A new table wrapping table but normalized according to settings.
Throws:
InvalidSettingsException - If the settings are incomplete or cannot be applied to spec.

createSpec

public static DataTableSpec createSpec(DataTableSpec spec,
                                       ModelContentRO settings)
                                throws InvalidSettingsException
Reads the meta information from the settings object and constructs the DataTableSpec, which would be the outcome when a table complying with spec were fet to the load method.

Parameters:
spec - The original input spec.
settings - The normalization information.
Returns:
The DataTableSpec of the normalized table.
Throws:
InvalidSettingsException - If the settings are incomplete or cannot be applied to spec.

setErrorMessage

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

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.