lnsc
Interface FunctionalUnit

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Subinterfaces:
FunctionalUnit2
All Known Implementing Classes:
AbstractFunctionalUnit, AbstractFunctionalUnit2

public interface FunctionalUnit
extends java.lang.Cloneable, java.io.Serializable

Interface supported by every objects that can be used like a function. Every units in a neural network, and neural networks themselves are of this type. A functional unit has the only constraint of being a multivariate real-vector-valued function.

The FunctionalUnit interface has methods that provide information about the type of function encapsulated by the object such as number of inputs and outputs and whether it is differentiable or not. It also provides methods to read the values and derivatives of the function for a given single input pattern or a whole batch of patterns, in which case some extra information can also be recorded.

For a complete list of FunctionalUnit included in this package see FunctionalUnit Chart

Since:
1.0

Nested Class Summary
static class FunctionalUnit.ProcessPatternResult
          Return type for the method processPattern(double[], boolean, boolean).
 
Field Summary
static double[] EMPTY_PATTERN
          An empty pattern is a pattern of size 0.
 
Method Summary
 java.lang.Object clone()
           
 int getInputCount()
          Indicates the number of variables of the function.
 int getOutputCount()
          Indicates the number of values returned by the function.
 boolean isDifferentiable()
          Indicates whether or not the function is differentiable.
 boolean isStateless()
          Indicates whether or not the function output depends solely of the current input (and not of the previous pattern it has processed).
 boolean isTwiceDifferentiable()
          Indicates whether or not the function is twice differentiable.
 DataSet processDataSet(DataSet dataSet, java.lang.String[] recordList)
          Processes a set of input patterns and record the requested information.
 FunctionalUnit.ProcessPatternResult processPattern(double[] inputPattern, boolean computeDerivative, boolean computeSecondDerivative)
          Processes an input pattern and returns its output pattern and derivative (if requested).
 void reset()
          Reset internal transient state for non stateless functions.
 

Field Detail

EMPTY_PATTERN

public static final double[] EMPTY_PATTERN
An empty pattern is a pattern of size 0. It is the only input pattern pattern allowed for function of 0 inputs such as BiasUnit.

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException

getInputCount

public int getInputCount()
Indicates the number of variables of the function.

Returns:
Number of inputs.

getOutputCount

public int getOutputCount()
Indicates the number of values returned by the function.

Returns:
Number of outputs.

isDifferentiable

public boolean isDifferentiable()
Indicates whether or not the function is differentiable.

Returns:
true if it differentiable, false otherwise.

isStateless

public boolean isStateless()
Indicates whether or not the function output depends solely of the current input (and not of the previous pattern it has processed). (Any such internal state use for next computation should be in transient variables and not being serialized. They should be reseted on reset.)

Returns:
true if output depends solely on current input false otherwise.

isTwiceDifferentiable

public boolean isTwiceDifferentiable()
Indicates whether or not the function is twice differentiable.

Returns:
true if it twice differentiable, false otherwise.

processDataSet

public DataSet processDataSet(DataSet dataSet,
                              java.lang.String[] recordList)
Processes a set of input patterns and record the requested information. To get the derivatives for each pattern, use the keyword DataNames.DERIVATIVES, for the second derivatives use DataNames.SECOND_DERIVATIVES and for the error patterns, use DataNames.ERROR_PATTERNS. Derivatives are available only when the function is differentiable. Error patterns required DataNames.TARGET_PATTERNS to be in the provided data set.

Returns:
The given data set augmented with the DataNames.OUTPUT_PATTERNS and any other keywords supported requested. Each FunctionalUnit may provide extra keywords of its own.
See Also:
DataNames

processPattern

public FunctionalUnit.ProcessPatternResult processPattern(double[] inputPattern,
                                                          boolean computeDerivative,
                                                          boolean computeSecondDerivative)
Processes an input pattern and returns its output pattern and derivative (if requested).

Returns:
The output pattern and the derivative (if requested).

reset

public void reset()
Reset internal transient state for non stateless functions.