Class TDNN

java.lang.Object
  extended byNetwork
      extended byTDNN

public class TDNN
extends Network

The TDNN class is used to create Time Delay Neural Networks

Author:
Raymond McBride

Constructor Summary
TDNN(int inputs, int hiddens, int delays, int slope, double learningRate, double momentum, int totalEpochs, String fileID)
          This constructor for the TDNN specifies the number of Input Neurons and Hidden Neurons, the number of delays, the slope of their activation functions, the learning rate, the momentum, the number of training, epochs and set a network topology id for use with log files.
 
Method Summary
protected  void adjustHiddenWeights()
          Adjusts the weights of the Synapses between the Hidden and Input Neurons and Bias Neurons
protected  void adjustOutputWeights()
          Adjusts the weights of the Synapses between the Output and Hidden Neurons and Bias Neurons
protected  double calculateError()
          Calculates the output error
protected  void calculateHiddenError()
          Calculates the hidden error term
protected  void calculateHiddenOutput()
          Calculates the output of the Hidden Neurons
protected  void calculateHiddenWeightChange()
          Calculates the weight change to be made to the Synapses between the Hidden and Input Neurons and Bias Neurons
protected  void calculateOutputError()
          Calculates the output error term
protected  void calculateOutputWeightChange()
          Calculates the weight change to be made to the Synapses between the Output and Hidden Neurons and Bias Neurons
protected  void connectNeurons()
          Connects the Neurons
protected  void createNeurons()
          Creates the Neurons
protected  void createNeurons(int delays)
          Creates the Neurons
protected  BiasNeuron getBiasHidden()
          Gets the BiasNeuron to the HiddenNeurons
protected  BiasNeuron getBiasOutput()
          Gets the BiasNeuron to the OutputNeuron
protected  Synapse[] getBiasToHidden()
          Gets the Synapses between the BiasNeuron and the HiddenNeurons
protected  Synapse getBiasToHidden(int i)
          Gets a Synapse between the BiasNeuron and a HiddenNeuron
protected  Synapse getBiasToOutput()
          Gets the Synapse connecting the BiasNeuron to the OutputNeuron
protected  double getHiddenErrorTerm(int i)
          Gets a hiddenErrorTerm
protected  Neuron getHiddenNeuron(int i)
          Gets a HiddenNeuron
protected  Neuron[] getHiddenNeurons()
          Gets the HiddenNeurons
protected  Synapse[] getHiddenToOutput()
          Gets the Synapses between the HiddenNeurons and the OutputNeuron
protected  Synapse getHiddenToOutput(int i)
          Gets a Synapse between a HiddenNeuron and the OutputNeuron
protected  double[] getInputData()
          Gets the input data
protected  double getInputData(int i)
          Gets input data at a given position
protected  Neuron getInputNeuron(int i)
          Gets an InputNeuron
protected  Neuron[] getInputNeurons()
          Gets the InputNeurons
protected  Synapse[][] getInputToHidden()
          Gets all the Synapses between the InputNeurons and the HiddenNeurons
protected  Synapse[] getInputToHidden(int i)
          Gets the Synapses between an InputNeuron and the HiddenNeurons
protected  Synapse getInputToHidden(int i, int j)
          Gets the Synapse between an InputNeuron and a HiddenNeuron
protected  double getLearningRate()
          Gets the learning rate
protected  double getMomentum()
          Gets the momentum
protected  int getNextInput()
          Gets the next input position
protected  double getOutputErrorTerm()
          Gets the OutputErrorTerm
protected  int getSlope()
          Gets the slope
protected  void initialise()
          Initialises the network with data
protected  void sendToHidden()
          Transfers the weighted values to the HiddenNeurons
protected  void sendToOutput()
          Transfers the weighted values to the OutputNeuron
protected  void setBiasHidden(BiasNeuron biasHidden)
          Sets the BiasNeuron to the HiddenNeurons
protected  void setBiasOutput(BiasNeuron biasOutput)
          Sets the BiasNeuron to the OutputNeuron
protected  void setHiddenErrorTerm(double errorTerm, int i)
          Sets a hiddenErrorTerm
protected  void setHiddenNeuron(HiddenNeuron hiddenNeuron, int i)
          Sets a HiddenNeuron
protected  void setInputNeuron(InputNeuron inputNeuron, int i)
          Sets an InputNeuron
protected  void setOutputNeuron(OutputNeuron outputNeuron)
          Sets the OutputNeuron
protected  void setTargetOutput(double targetOutput)
          Sets the target output
 void test(double[] data)
          Starts testing the network
 void train(double[] data)
          Trains the network
 void validate(double[] data)
          Starts validating the network
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TDNN

public TDNN(int inputs,
            int hiddens,
            int delays,
            int slope,
            double learningRate,
            double momentum,
            int totalEpochs,
            String fileID)
This constructor for the TDNN specifies the number of Input Neurons and Hidden Neurons, the number of delays, the slope of their activation functions, the learning rate, the momentum, the number of training, epochs and set a network topology id for use with log files.

Parameters:
inputs - The number of Input Neurons
hiddens - The number of Hidden Neurons
delays - The number of delays
slope - The slope of their activation functions
learningRate - The learning rate
momentum - The momentum
totalEpochs - The number of training epochs
fileID - The network topology id
Method Detail

createNeurons

protected void createNeurons(int delays)
Creates the Neurons

Parameters:
delays - The number of delays

calculateHiddenOutput

protected void calculateHiddenOutput()
Calculates the output of the Hidden Neurons


calculateOutputWeightChange

protected void calculateOutputWeightChange()
Calculates the weight change to be made to the Synapses between the Output and Hidden Neurons and Bias Neurons


calculateHiddenWeightChange

protected void calculateHiddenWeightChange()
Calculates the weight change to be made to the Synapses between the Hidden and Input Neurons and Bias Neurons


calculateHiddenError

protected void calculateHiddenError()
Calculates the hidden error term


initialise

protected void initialise()
Initialises the network with data


createNeurons

protected void createNeurons()
Creates the Neurons


connectNeurons

protected void connectNeurons()
Connects the Neurons


calculateOutputError

protected void calculateOutputError()
Calculates the output error term


adjustOutputWeights

protected void adjustOutputWeights()
Adjusts the weights of the Synapses between the Output and Hidden Neurons and Bias Neurons


adjustHiddenWeights

protected void adjustHiddenWeights()
Adjusts the weights of the Synapses between the Hidden and Input Neurons and Bias Neurons


sendToHidden

protected void sendToHidden()
Transfers the weighted values to the HiddenNeurons


calculateError

protected double calculateError()
Calculates the output error


sendToOutput

protected void sendToOutput()
Transfers the weighted values to the OutputNeuron


train

public void train(double[] data)
Trains the network


test

public void test(double[] data)
Starts testing the network


validate

public void validate(double[] data)
Starts validating the network


getSlope

protected int getSlope()
Gets the slope

Returns:
slope

getLearningRate

protected double getLearningRate()
Gets the learning rate

Returns:
learningRate

getMomentum

protected double getMomentum()
Gets the momentum

Returns:
momentum

setTargetOutput

protected void setTargetOutput(double targetOutput)
Sets the target output

Parameters:
targetOutput - the target output

setOutputNeuron

protected void setOutputNeuron(OutputNeuron outputNeuron)
Sets the OutputNeuron

Parameters:
outputNeuron - the OutputNeuron

getOutputErrorTerm

protected double getOutputErrorTerm()
Gets the OutputErrorTerm

Returns:
outputErrorTerm

getHiddenErrorTerm

protected double getHiddenErrorTerm(int i)
Gets a hiddenErrorTerm

Parameters:
i - its position
Returns:
hiddenErrorTerm an array of error terms

setHiddenErrorTerm

protected void setHiddenErrorTerm(double errorTerm,
                                  int i)
Sets a hiddenErrorTerm

Parameters:
errorTerm - the new error term
i - its position

getNextInput

protected int getNextInput()
Gets the next input position

Returns:
nextInput

getBiasToOutput

protected Synapse getBiasToOutput()
Gets the Synapse connecting the BiasNeuron to the OutputNeuron

Returns:
biasToOutput

setBiasHidden

protected void setBiasHidden(BiasNeuron biasHidden)
Sets the BiasNeuron to the HiddenNeurons

Parameters:
biasHidden - the BiasNeuron to the HiddenNeurons

getBiasHidden

protected BiasNeuron getBiasHidden()
Gets the BiasNeuron to the HiddenNeurons

Returns:
biasHidden the BiasNeuron to the HiddenNeurons

setBiasOutput

protected void setBiasOutput(BiasNeuron biasOutput)
Sets the BiasNeuron to the OutputNeuron

Parameters:
biasOutput - the BiasNeuron to the OutputNeuron

getBiasOutput

protected BiasNeuron getBiasOutput()
Gets the BiasNeuron to the OutputNeuron

Returns:
biasOutput the BiasNeuron to the OutputNeuron

getBiasToHidden

protected Synapse[] getBiasToHidden()
Gets the Synapses between the BiasNeuron and the HiddenNeurons

Returns:
biasToHidden the array of Synapses

getBiasToHidden

protected Synapse getBiasToHidden(int i)
Gets a Synapse between the BiasNeuron and a HiddenNeuron

Parameters:
i - its position
Returns:
the Synapse at that position

getHiddenToOutput

protected Synapse getHiddenToOutput(int i)
Gets a Synapse between a HiddenNeuron and the OutputNeuron

Parameters:
i - its position
Returns:
the Synapse at the position

getHiddenToOutput

protected Synapse[] getHiddenToOutput()
Gets the Synapses between the HiddenNeurons and the OutputNeuron

Returns:
hiddenToOutput the array of Synapses

getInputToHidden

protected Synapse[][] getInputToHidden()
Gets all the Synapses between the InputNeurons and the HiddenNeurons

Returns:
inputToHidden the 2D array of Synapses

getInputToHidden

protected Synapse[] getInputToHidden(int i)
Gets the Synapses between an InputNeuron and the HiddenNeurons

Parameters:
i - its position
Returns:
the array of Synapses at that position

getInputToHidden

protected Synapse getInputToHidden(int i,
                                   int j)
Gets the Synapse between an InputNeuron and a HiddenNeuron

Parameters:
i - its x position
j - its y position
Returns:
the Synapse at that position

getInputNeuron

protected Neuron getInputNeuron(int i)
Gets an InputNeuron

Parameters:
i - its position
Returns:
the InputNeuron

getInputNeurons

protected Neuron[] getInputNeurons()
Gets the InputNeurons

Returns:
inputNeurons the array of InputNeurons

setInputNeuron

protected void setInputNeuron(InputNeuron inputNeuron,
                              int i)
Sets an InputNeuron

Parameters:
inputNeuron - the new InputNeuron
i - its position

getHiddenNeuron

protected Neuron getHiddenNeuron(int i)
Gets a HiddenNeuron

Parameters:
i - its position
Returns:
the HiddenNeuron

getHiddenNeurons

protected Neuron[] getHiddenNeurons()
Gets the HiddenNeurons

Returns:
hiddenNeurons the array of HiddenNeurons

setHiddenNeuron

protected void setHiddenNeuron(HiddenNeuron hiddenNeuron,
                               int i)
Sets a HiddenNeuron

Parameters:
hiddenNeuron - the new HiddenNeuron
i - its position

getInputData

protected double getInputData(int i)
Gets input data at a given position

Parameters:
i - its position
Returns:
the double at that position

getInputData

protected double[] getInputData()
Gets the input data

Returns:
inputData


Copyright © 2004 Raymond McBride. All Rights Reserved.