org.knime.base.data.neural
Class MultiLayerPerceptron

java.lang.Object
  extended by org.knime.base.data.neural.MultiLayerPerceptron

public class MultiLayerPerceptron
extends Object

Representation of a MultiLayer Perceptron, a neural net with one or more hidden layers.

Author:
Nicolas Cebron, University of Konstanz

Field Summary
static String ALLLAYERS_KEY
          Key to store all layers of the MLP in the ModelContent.
static int CLASSIFICATION_MODE
          Indicates whether the MLP does classification with multiple output neurons, one neuron for each class.
static String CLASSVALUE_KEY
          Key to store the class value of a neuron in the ModelContent.
static String INPUT_KEY
          Key to store the input value of a neuron in the ModelContent.
static String MODE_KEY
          Key to store the mode of the MLP in the ModelContent.
static int REGRESSION_MODE
          Indicates whether the MLP does regression with one output neuron.
static String THRESHOLD_KEY
          Key to store the threshold value of a neuron in the ModelContent.
static String WEIGHT_KEY
          Key to store the weights of a neuron in the ModelContent.
 
Constructor Summary
MultiLayerPerceptron()
          Constructor for an empty Neural Net.
MultiLayerPerceptron(Architecture a)
          Constructs a net with a given architecture.
MultiLayerPerceptron(Layer[] layers)
          Constructs a net with the given layers.
 
Method Summary
 Architecture getArchitecture()
           
 HashMap<DataCell,Integer> getClassMapping()
          Allows to get the class mapping from output neurons to class values.
 String getClassOutput(double[] in)
          Finds the winner and returns its class output value.
 HashMap<String,Integer> getInputMapping()
          Allows to get the input mapping from input neurons to columns.
 Layer getLayer(int i)
          Returns layer at a given position.
 Layer[] getLayers()
           
 int getMode()
           
 int getNrLayers()
           
static MultiLayerPerceptron loadPredictorParams(ModelContentRO predParams)
           
 double[] output(double[] in)
          Evaluates input and returns output of output neurons.
 double[] output(Double[] in)
          Computes the output for given input.
 void savePredictorParams(ModelContentWO predParams)
          Stores this MLP model to config.
 void setArchitecture(Architecture architecture)
          Sets the architecture.
 void setClassMapping(HashMap<DataCell,Integer> map)
          Allows for setting the class mapping from output neurons to class values.
 void setInputMapping(HashMap<String,Integer> map)
          Allows for setting the input mapping from input neurons to class values.
 void setLayer(int i, Layer layer)
          Sets the layer at a given position.
 void setLayers(Layer[] layers)
          Sets all layers.
 void setMode(int mode)
          Sets the mode of the MLP.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_KEY

public static final String INPUT_KEY
Key to store the input value of a neuron in the ModelContent.

See Also:
Constant Field Values

WEIGHT_KEY

public static final String WEIGHT_KEY
Key to store the weights of a neuron in the ModelContent.

See Also:
Constant Field Values

THRESHOLD_KEY

public static final String THRESHOLD_KEY
Key to store the threshold value of a neuron in the ModelContent.

See Also:
Constant Field Values

CLASSVALUE_KEY

public static final String CLASSVALUE_KEY
Key to store the class value of a neuron in the ModelContent.

See Also:
Constant Field Values

MODE_KEY

public static final String MODE_KEY
Key to store the mode of the MLP in the ModelContent.

See Also:
Constant Field Values

ALLLAYERS_KEY

public static final String ALLLAYERS_KEY
Key to store all layers of the MLP in the ModelContent.

See Also:
Constant Field Values

REGRESSION_MODE

public static final int REGRESSION_MODE
Indicates whether the MLP does regression with one output neuron.

See Also:
Constant Field Values

CLASSIFICATION_MODE

public static final int CLASSIFICATION_MODE
Indicates whether the MLP does classification with multiple output neurons, one neuron for each class.

See Also:
Constant Field Values
Constructor Detail

MultiLayerPerceptron

public MultiLayerPerceptron(Layer[] layers)
Constructs a net with the given layers.

Parameters:
layers - layers for the new net

MultiLayerPerceptron

public MultiLayerPerceptron(Architecture a)
Constructs a net with a given architecture.

Parameters:
a - architecture for the new net

MultiLayerPerceptron

public MultiLayerPerceptron()
Constructor for an empty Neural Net.

Method Detail

setClassMapping

public void setClassMapping(HashMap<DataCell,Integer> map)
Allows for setting the class mapping from output neurons to class values.

Parameters:
map - a HashMap containing the mapping.

setInputMapping

public void setInputMapping(HashMap<String,Integer> map)
Allows for setting the input mapping from input neurons to class values.

Parameters:
map - a HashMap containing the mapping

getClassMapping

public HashMap<DataCell,Integer> getClassMapping()
Allows to get the class mapping from output neurons to class values.

Returns:
a HashMap containing the mapping.

getInputMapping

public HashMap<String,Integer> getInputMapping()
Allows to get the input mapping from input neurons to columns.

Returns:
a HashMap containing the mapping

getLayers

public Layer[] getLayers()
Returns:
the layers of the net.

getLayer

public Layer getLayer(int i)
Returns layer at a given position.

Parameters:
i - position
Returns:
layer at position i

getNrLayers

public int getNrLayers()
Returns:
number of Layers in MLP.

setLayers

public void setLayers(Layer[] layers)
Sets all layers.

Parameters:
layers - new layers for the net

setLayer

public void setLayer(int i,
                     Layer layer)
Sets the layer at a given position.

Parameters:
i - position
layer - new layer for position i

output

public double[] output(double[] in)
Evaluates input and returns output of output neurons.

Parameters:
in - input for the mlp
Returns:
output of the output neurons after having processed a forward wave through the net

output

public double[] output(Double[] in)
Computes the output for given input.

Parameters:
in - the input values
Returns:
output values of MLP.

getClassOutput

public String getClassOutput(double[] in)
Finds the winner and returns its class output value.

Parameters:
in - input for the mlp
Returns:
class value

getArchitecture

public Architecture getArchitecture()
Returns:
Architecture of the net

setArchitecture

public void setArchitecture(Architecture architecture)
Sets the architecture.

Parameters:
architecture - Architecture for the net

savePredictorParams

public void savePredictorParams(ModelContentWO predParams)
Stores this MLP model to config.

Parameters:
predParams - ModelContent to write into.

getMode

public int getMode()
Returns:
the mode of the MLP
See Also:
CLASSIFICATION_MODE, REGRESSION_MODE

setMode

public void setMode(int mode)
Sets the mode of the MLP. This can either be CLASSIFICATION_MODE or REGRESSION_MODE, other values are ignored.

Parameters:
mode - the mode of the MLP
See Also:
CLASSIFICATION_MODE, REGRESSION_MODE

loadPredictorParams

public static MultiLayerPerceptron loadPredictorParams(ModelContentRO predParams)
                                                throws InvalidSettingsException
Parameters:
predParams - the ConfigObject containing the model of the mlp
Returns:
a new MultiLayerPerceptron based on the config
Throws:
InvalidSettingsException - if settings are incorrect


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.