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

java.lang.Object
  extended by org.knime.base.node.mine.bfn.BasisFunctionPredictorCellFactory
All Implemented Interfaces:
CellFactory

public class BasisFunctionPredictorCellFactory
extends Object
implements CellFactory

This predictor cell factory predicts the passed rows using the underlying basisfunction model.

Author:
Thomas Gabriel, University of Konstanz

Constructor Summary
BasisFunctionPredictorCellFactory(DataColumnSpec[] specs, boolean appendClassProps)
          Create new predictor cell factory.
BasisFunctionPredictorCellFactory(DataTableSpec dataSpec, DataColumnSpec[] specs, int[] filteredColumns, Map<DataCell,List<BasisFunctionPredictorRow>> model, double dontKnowClass, boolean normClass, boolean appendClassProps)
          Appends one column to the given data to make a prediction for each row using the model which contains one BasisFunctionPredictorRow column.
 
Method Summary
 DataCell[] getCells(DataRow row)
          Predicts given row using the underlying basis function model.
 DataColumnSpec[] getColumnSpecs()
          The column specs for the cells that are generated in the getCells() method.
protected  DataCell[] predict(DataRow row, Map<DataCell,List<BasisFunctionPredictorRow>> model)
          Predicts an unknown row to the given model.
 void setProgress(int curRowNr, int rowCount, RowKey lastKey, ExecutionMonitor exec)
          This method is called when a row has been processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasisFunctionPredictorCellFactory

public BasisFunctionPredictorCellFactory(DataColumnSpec[] specs,
                                         boolean appendClassProps)
Create new predictor cell factory. Only used to create the ColumnRearranger with the appended model spec.

Parameters:
specs - the appended column specs
appendClassProps - if class probabilities should be append

BasisFunctionPredictorCellFactory

public BasisFunctionPredictorCellFactory(DataTableSpec dataSpec,
                                         DataColumnSpec[] specs,
                                         int[] filteredColumns,
                                         Map<DataCell,List<BasisFunctionPredictorRow>> model,
                                         double dontKnowClass,
                                         boolean normClass,
                                         boolean appendClassProps)
Appends one column to the given data to make a prediction for each row using the model which contains one BasisFunctionPredictorRow column.

Parameters:
dataSpec - the spec of the test data
specs - names and types of the rule model
filteredColumns - use only those column for prediction (part of the of training data)
model - the trained model as list of rows
dontKnowClass - the don't know class probability
normClass - normalize classification output
appendClassProps - if class probabilities should be append
Throws:
NullPointerException - if one of the arguments is null
Method Detail

predict

protected DataCell[] predict(DataRow row,
                             Map<DataCell,List<BasisFunctionPredictorRow>> model)
Predicts an unknown row to the given model.

Parameters:
row - the row to predict
model - a list of rules
Returns:
mapping class label to array of assigned class degrees

getCells

public DataCell[] getCells(DataRow row)
Predicts given row using the underlying basis function model. Get the new cells for a given row. These cells are incorporated into the existing row. The way it is done is defined through the ColumnRearranger using this object.

Specified by:
getCells in interface CellFactory
Parameters:
row - The row of interest.
Returns:
The new cells to that row.

getColumnSpecs

public DataColumnSpec[] getColumnSpecs()
The column specs for the cells that are generated in the getCells() method. This method is only called once, there is no need to cache the return value. The length of the returned array must match the length of the array returned by the getCells(DataRow) method and also the types must match, i.e. the type of the respective DataColumnSpec must be of the same type or a super type of the cell as returned by getCells(DataRow).

Specified by:
getColumnSpecs in interface CellFactory
Returns:
The specs to the newly created cells.

setProgress

public void setProgress(int curRowNr,
                        int rowCount,
                        RowKey lastKey,
                        ExecutionMonitor exec)
This method is called when a row has been processed. It allows the implementor to set progress in the execution monitor and also some meaningful progress message.

Note, you don't need to check exec.checkCanceled() in the implementation as this is done in the calling class.

Specified by:
setProgress in interface CellFactory
Parameters:
curRowNr - The number of the row just processed
rowCount - The total number of rows.
lastKey - The row's key.
exec - The execution monitor to report progress to.


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.