org.knime.base.node.mine.bfn
Class BasisFunctionLearnerTable

java.lang.Object
  extended by org.knime.base.node.mine.bfn.BasisFunctionLearnerTable
All Implemented Interfaces:
Iterable<DataRow>, DataTable

public final class BasisFunctionLearnerTable
extends Object
implements DataTable

This class implements the DDA-algorithm published by Berthold&Huber which iteratively introduces new basisfunctions and/or shrinks already existing ones of conflicting classes during the training algorithm.

The learning algorithm itself is based on two distinct phases. During the training phase, miss-classified pattern either prompt the spontaneous creation of new basisfunctions units (commitment) or the adjustment of conflicting basisfunction radii (shrinking of Basisfunctions belonging to incorrect classes). To commit a new prototype, none of existing Basisfunctions of the correct class has an activation above a certain threshold and, after shrinking, no Basisfunction of a conflicting class is allowed to have an activation above.

This underlying DataTable contains just one column derived from BasisFunctionLearnerRow.

Author:
Thomas Gabriel, University of Konstanz

Nested Class Summary
static interface BasisFunctionLearnerTable.MissingValueReplacementFunction
          General missing values replacement interface.
 
Field Summary
static String MISSING
          NodeSettings key for the missing replacement value.
static BasisFunctionLearnerTable.MissingValueReplacementFunction[] MISSINGS
          A list of possible missing value replacements.
 
Constructor Summary
BasisFunctionLearnerTable(BufferedDataTable data, String[] dataColumns, String[] targetColumns, BasisFunctionFactory factory, BasisFunctionLearnerTable.MissingValueReplacementFunction missing, boolean shrinkAfterCommit, boolean maxClassCoverage, int maxEpochs, ExecutionMonitor exec)
          Creates a new basis function learner and starts the training algorithm.
BasisFunctionLearnerTable(BufferedDataTable data, String[] dataColumns, String[] targetColumns, BasisFunctionFactory factory, BasisFunctionLearnerTable.MissingValueReplacementFunction missing, boolean shrinkAfterCommit, boolean maxClassCoverage, int maxEpochs, int[] startRuleCount, ExecutionMonitor exec)
          Creates a new basisfunction learner and starts the training algorithm.
 
Method Summary
 void addBasisFunction(BasisFunctionLearnerRow bf)
          Adds the given basis function to the list using its nominal value for class assignment.
 void explain(BufferedDataTable data, String[] dataColumns, String[] targetColumns)
          Assigns all explained examples to to basis functions.
 BasisFunctionIterator getBasisFunctionIterator()
           
 Map<DataCell,List<BasisFunctionLearnerRow>> getBasisFunctions()
          Returns the map of basis functions list for each class.
(package private)  int[] getClassDistribution()
           
 DataTableSpec getDataTableSpec()
          Returns the DataTableSpec object of this table which gives information about the structure of this data table.
(package private)  BasisFunctionFactory getFactory()
           
 DefaultHiLiteMapper getHiLiteMapper()
           
 int getNumBasisFunctions()
          Returns the overall number of Basisfunction in this model.
(package private)  int getNumBasisFunctions(DataCell classInfo)
          Returns the number of basis functions for the given class.
protected  int getNumClasses()
           
 BasisFunctionIterator iterator()
          Returns a row iterator which returns each row one-by-one from the table.
 void print(PrintStream out)
          Adds info about this object to the given stream.
 void removeBasisFunction(BasisFunctionLearnerRow bf)
          Removes the given basisfunction from the model and updates all internal members.
 void saveInfos(ModelContentWO pp)
          Saves the results of the training to the given object as string key-value pairs.
 void write(StringBuffer buf, boolean full)
          Write this model into the given string buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MISSING

public static final String MISSING
NodeSettings key for the missing replacement value.

See Also:
Constant Field Values

MISSINGS

public static final BasisFunctionLearnerTable.MissingValueReplacementFunction[] MISSINGS
A list of possible missing value replacements. In addition, the so called BEST GUESS and INCORP methods can be applied.

Constructor Detail

BasisFunctionLearnerTable

public BasisFunctionLearnerTable(BufferedDataTable data,
                                 String[] dataColumns,
                                 String[] targetColumns,
                                 BasisFunctionFactory factory,
                                 BasisFunctionLearnerTable.MissingValueReplacementFunction missing,
                                 boolean shrinkAfterCommit,
                                 boolean maxClassCoverage,
                                 int maxEpochs,
                                 ExecutionMonitor exec)
                          throws CanceledExecutionException
Creates a new basis function learner and starts the training algorithm. The given data (only double columns) is used for training. Its assigned class label is used to determine the class info for each row. Furthermore, we provide a name for the new model column. The factory is used to automatically generate new prototypes of a certain basisfunction type.

Parameters:
data - the training data from which are all DoubleCell columns are used for training and the last the specified target column for classification
dataColumns - used for training
targetColumns - name of the classification column
factory - the factory used to generate BasisFunctionLearnerRows
missing - the missing values replacement function
shrinkAfterCommit - if true do it
maxClassCoverage - use only maximum class coverage to check
maxEpochs - maximum number of epochs to train
exec - the execution monitor
Throws:
CanceledExecutionException - always tested when a new run over data is started.

BasisFunctionLearnerTable

public BasisFunctionLearnerTable(BufferedDataTable data,
                                 String[] dataColumns,
                                 String[] targetColumns,
                                 BasisFunctionFactory factory,
                                 BasisFunctionLearnerTable.MissingValueReplacementFunction missing,
                                 boolean shrinkAfterCommit,
                                 boolean maxClassCoverage,
                                 int maxEpochs,
                                 int[] startRuleCount,
                                 ExecutionMonitor exec)
                          throws CanceledExecutionException
Creates a new basisfunction learner and starts the training algorithm. The given data (only double columns) is used for training. Its assigned class label is used to determine the class info for each row. Furthermore, we provide a name for the new model column. The factory is used to automatically generate new prototypes of a certain basisfunction type.

Parameters:
data - The training data from which are all DoubleCell columns are used for training and the last the specified target column for classification
dataColumns - used for training
targetColumns - name of the classification column
factory - the factory used to generate BasisFunctionLearnerRows
missing - the missing values replacement function
shrinkAfterCommit - if true do it
maxClassCoverage - use only maximum class coverage to check
maxEpochs - maximum number of epochs to train
startRuleCount - at this point
exec - the execution monitor
Throws:
CanceledExecutionException - always tested when a new run over data is started
Method Detail

explain

public void explain(BufferedDataTable data,
                    String[] dataColumns,
                    String[] targetColumns)
Assigns all explained examples to to basis functions.

Parameters:
data - the data to explain
dataColumns - used for training only
targetColumns - names of target columns

getFactory

BasisFunctionFactory getFactory()
Returns:
the model's basisfunction factory

addBasisFunction

public void addBasisFunction(BasisFunctionLearnerRow bf)
Adds the given basis function to the list using its nominal value for class assignment.

Parameters:
bf - the basis function to add
See Also:
removeBasisFunction(BasisFunctionLearnerRow)

removeBasisFunction

public void removeBasisFunction(BasisFunctionLearnerRow bf)
Removes the given basisfunction from the model and updates all internal members.

Parameters:
bf - the basis function to remove.
See Also:
addBasisFunction(BasisFunctionLearnerRow)

getNumBasisFunctions

public int getNumBasisFunctions()
Returns the overall number of Basisfunction in this model.

Returns:
the number of basis functions

getNumClasses

protected int getNumClasses()
Returns:
the number of different classes

getNumBasisFunctions

int getNumBasisFunctions(DataCell classInfo)
Returns the number of basis functions for the given class.

Parameters:
classInfo - the class to get the number of basisfunctions for
Returns:
the number of basisfunctions for the given class or 0 if no Basisfunction is available for the given class or the class is not in the list
Throws:
NullPointerException - if the class label is null
See Also:
getNumBasisFunctions()

iterator

public BasisFunctionIterator 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

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

getBasisFunctions

public Map<DataCell,List<BasisFunctionLearnerRow>> getBasisFunctions()
Returns the map of basis functions list for each class. The key is the DataCell info and the value a list of basisfunctions.

Returns:
the key to list of basis functions' map

getClassDistribution

int[] getClassDistribution()
Returns:
an array holding the number of basis functions for each class

getBasisFunctionIterator

public BasisFunctionIterator getBasisFunctionIterator()
Returns:
a new iterator to get all basis functions from this model

print

public void print(PrintStream out)
Adds info about this object to the given stream.

Parameters:
out - the stream to add info to
Throws:
NullPointerException - if the given stream is null

saveInfos

public void saveInfos(ModelContentWO pp)
Saves the results of the training to the given object as string key-value pairs.

Parameters:
pp - the object to write result strings to

write

public void write(StringBuffer buf,
                  boolean full)
Write this model into the given string buffer.

Parameters:
buf - the buffer to write into
full - write full description including the entire model

getHiLiteMapper

public DefaultHiLiteMapper getHiLiteMapper()
Returns:
the hilite mapper which maps rules to covered instances


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.