org.n52.operation.fluxnet
Class FluxNetAlgorithm

java.lang.Object
  extended by org.n52.operation.fluxnet.FluxNetAlgorithm
All Implemented Interfaces:
AlgorithmN, AlgorithmOnList

public class FluxNetAlgorithm
extends java.lang.Object
implements AlgorithmOnList

Class for applying the neural network called "fluxnet" on a number of bands and getting the resulting values. It is to be applied for one pixel at a time.

First instantiate the class with the network file and the configuration file, which will initialize the network topology, and then call the "calculate" function repeatedly for every pixel. The network file is the result of the previous process ("training the network"), and contains knowledge about the number of input and output bands used, and the network topology. The configuration file must correspond to the network file, and contains the descriptions of the input and output bands, and also their scaling parameters.

Author:
Bas Retsios

Constructor Summary
FluxNetAlgorithm(java.lang.String netFile, java.lang.String configFile)
          Constructor
 
Method Summary
 double[] calculate(double[] params)
          Uses the network to calculate the output for the given parameters
 Algorithm getAlgorithm(int index)
          Get the names and descriptions of each output value.
 int getNrAlgorithms()
          Returns the number of output values.
 int getNrParams()
          Returns the number of parameters.
 java.lang.String getParamDescription(int paramNr)
          Returns a Description of the parameter.
 java.lang.String getParamName(int paramNr)
          Returns the Name of the parameter.
static void main(java.lang.String[] args)
          Start a sample form for trying-out FluxNetAlgorithm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FluxNetAlgorithm

public FluxNetAlgorithm(java.lang.String netFile,
                        java.lang.String configFile)
Constructor

Parameters:
netFile - the network file that is the result of training the neural network
configFile - the configuration file that contains the parameters and their scaling coefficients

The network file and the configuration file correspond to eachother (form a pair), as they both contain information about the number of input and output bands used. Besides, the scaling coefficients stored in the configuration file are also a result of the "training process", and can therefore only be used with the network file that was created during the same process.

Method Detail

main

public static void main(java.lang.String[] args)
Start a sample form for trying-out FluxNetAlgorithm

Parameters:
args - An array containing two Strings. The first String is the url or filename of the network file that is the result of training the neural network. The second String is the url or filename of the configuration file that contains the parameters and their scaling coefficients.

calculate

public double[] calculate(double[] params)
Uses the network to calculate the output for the given parameters

Specified by:
calculate in interface AlgorithmN
Parameters:
params - the list of parameters, as specified in the configuration file
Returns:
the output, as specified in the configuration file

getNrParams

public int getNrParams()
Returns the number of parameters.

Specified by:
getNrParams in interface AlgorithmOnList
Returns:
The number of parameters needed for running this AlgorithmOnList. This is taken from the configuration file.

getParamName

public java.lang.String getParamName(int paramNr)
                              throws java.lang.IndexOutOfBoundsException
Returns the Name of the parameter.

Specified by:
getParamName in interface AlgorithmOnList
Parameters:
paramNr - the 0-based index of the parameter requested. Must be between 0 and getNrParams()-1
Returns:
The name of the specified parameter. This is taken from the configuration file.
Throws:
java.lang.IndexOutOfBoundsException - when paramNr is negative or larger or equal to {#getNrParams()}

getParamDescription

public java.lang.String getParamDescription(int paramNr)
                                     throws java.lang.IndexOutOfBoundsException
Returns a Description of the parameter. Intended to give more information than getParamName().

Specified by:
getParamDescription in interface AlgorithmOnList
Parameters:
paramNr - The 0-based index of the parameter requested. Must be between 0 and getNrParams()-1
Returns:
The description of the specified parameter. This is taken from the configuration file.
Throws:
java.lang.IndexOutOfBoundsException - when paramNr is negative or larger or equal to {#getNrParams()}

getNrAlgorithms

public int getNrAlgorithms()
Returns the number of output values.

Specified by:
getNrAlgorithms in interface AlgorithmOnList
Returns:
The number of output values returned when running this AlgorithmOnList. This is taken from the configuration file.

[This function is still under development. Its name and "signature" may change in the future]


getAlgorithm

public Algorithm getAlgorithm(int index)
Get the names and descriptions of each output value.

Specified by:
getAlgorithm in interface AlgorithmOnList
Returns:
An Algorithm that gives access to the name and description of each output value of this AlgorithmOnList. This is taken from the configuration file. The calculate function of the returned Algorithm will work correctly, but for performance reasons it is recommended to call the calculate of FluxNetAlgorithm that returns multiple results simultaneously.

[This function is still under development. Its name and "signature" may change in the future]