org.simnet.networks
Class Backprop

java.lang.Object
  extended by org.simnet.interfaces.Network
      extended by org.simnet.networks.Backprop
All Implemented Interfaces:
EventListener, WorldListener
Direct Known Subclasses:
Elman

public class Backprop
extends Network

Backprop implements a standard three layer backpropagation network.


Field Summary
 
Fields inherited from class org.simnet.interfaces.Network
CONTINUOUS, DISCRETE
 
Constructor Summary
Backprop()
          Default constructor.
Backprop(int inputs, int hidden, int outputs, Layout layout)
          Construct a backprop network with a specified number of input, hidden, and output layers.
 
Method Summary
 void attachInputsAndOutputs()
          Attach training files to SNARLI network.
 void batchIterate()
          Batch train for one iteration.
 void batchTrain()
          Forwards to Snarli batchTrain() method.
protected  void buildInitialNetwork()
          Build the default network.
 void buildSnarliNetwork()
          Create the Snarli network.
 void defaultInit()
          Build network and initialize nodes and weights to appropriate values.
 double[] getBiases(StandardNetwork net)
          Returns bias values.
protected  SigmoidalNeuron getDefaultNeuron()
          Return the default neuron, with settings, for backprop nets.
 int getEpochs()
           
 double getError()
           
 int getErrorInterval()
           
 double getEta()
           
 edu.wlu.cs.levy.SNARLI.BPLayer getHid()
           
 edu.wlu.cs.levy.SNARLI.BPLayer getInp()
           
 double getMu()
           
 int getNHidden()
           
 int getNInputs()
           
 int getNOutputs()
           
 edu.wlu.cs.levy.SNARLI.BPLayer getOut()
           
 File getTrainingINFile()
           
 double[][] getTrainingInputs()
           
 File getTrainingOUTFile()
           
 double[][] getTrainingOutputs()
           
 void iterate()
          Iterate network training.
 void randomize()
          Randomize the network.
 void setBiases(StandardNetwork net, double[] biases)
          Set bias values for all neurons in this network.
 void setEpochs(int epochs)
           
 void setError(double error)
           
 void setErrorInterval(int errorInterval)
           
 void setEta(double eta)
           
 void setHid(edu.wlu.cs.levy.SNARLI.BPLayer hid)
           
 void setInp(edu.wlu.cs.levy.SNARLI.BPLayer inp)
           
 void setMu(double mu)
           
 void setNHidden(int nHidden)
           
 void setNInputs(int nInputs)
           
 void setNOutputs(int nOutputs)
           
 void setOut(edu.wlu.cs.levy.SNARLI.BPLayer out)
           
 void setTrainingINFile(File trainingINFile)
          Sets the input training file.
 void setTrainingInputs(double[][] trainingInputs)
           
 void setTrainingOUTFile(File trainingOUTFile)
          Sets the output training file.
 void setTrainingOutputs(double[][] trainingOutputs)
           
 void train()
          Train the network.
 void update()
          The core update function of the neural network.
 void updateSimbrainNetwork()
          Update connections and biases of simbrain network.
 
Methods inherited from class org.simnet.interfaces.Network
addNetwork, addNetworkList, addNetworkListener, addNeuron, addNeuron, addNeuronList, addWeight, addWeight, changeNeuron, changeSynapse, checkAllBounds, clearActivations, clearInputs, close, deleteNetwork, deleteNeuron, deleteNeuron, deleteWeight, deleteWeight, fireClampChanged, fireCouplingChanged, fireNetworkChanged, fireNeuronAdded, fireNeuronChanged, fireNeuronDeleted, fireSubnetAdded, fireSubnetDeleted, fireSynapseAdded, fireSynapseChanged, fireSynapseDeleted, getClampNeurons, getClampWeights, getCouplingList, getDepth, getFlatNetworkList, getFlatNeuronList, getFlatSynapseList, getId, getIndents, getInputNeurons, getInteractionMode, getListenerList, getNetwork, getNetworkList, getNetworkParent, getNetworkThread, getNeuron, getNeuron, getNeuronCount, getNeuronList, getOutputNeurons, getPrecision, getRoot, getRoundingOff, getState, getSynapse, getTime, getTimeLabel, getTimeStep, getTimeType, getType, getUnits, getWeight, getWeight, getWeight, getWeightCount, getWeightList, getWorkspace, init, initNeurons, initParents, initWeights, isRoot, isRoundOffActivationValues, isUpdateCompleted, randomizeNeurons, randomizeWeights, removeNetworkListener, round, roundAll, setClampNeurons, setClampWeights, setId, setInteractionMode, setLowerBounds, setNetworkList, setNetworkParent, setNetworkThread, setNeuronList, setPrecision, setRoundingOff, setRoundOffActivationValues, setTime, setTimeStep, setUpdateCompleted, setUpperBounds, setWeightList, setWeightsToZero, setWorkspace, toString, updateAllNetworks, updateAllNeurons, updateAllWeights, updateIds, updateInputs, updateTime, updateTimeType, updateTopLevel, updateWorldListeners, updateWorlds, worldChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Backprop

public Backprop()
Default constructor.


Backprop

public Backprop(int inputs,
                int hidden,
                int outputs,
                Layout layout)
Construct a backprop network with a specified number of input, hidden, and output layers.

Parameters:
inputs - Number of neurons to be inputs
hidden - Number of neurons to be hidden
outputs - Number of neurons to be outputs
layout - Defines how the neurons are layed out
Method Detail

defaultInit

public void defaultInit()
Build network and initialize nodes and weights to appropriate values.


buildInitialNetwork

protected void buildInitialNetwork()
Build the default network.


buildSnarliNetwork

public void buildSnarliNetwork()
Create the Snarli network.


getDefaultNeuron

protected SigmoidalNeuron getDefaultNeuron()
Return the default neuron, with settings, for backprop nets.

Returns:
the neuron, with appropriate settings, that should be used in building a backprop net.

update

public void update()
The core update function of the neural network. Calls the current update function on each neuron, decays all the neurons, and checks their bounds.

Specified by:
update in class Network

train

public void train()
Train the network.


iterate

public void iterate()
Iterate network training.


attachInputsAndOutputs

public void attachInputsAndOutputs()
Attach training files to SNARLI network.


updateSimbrainNetwork

public void updateSimbrainNetwork()
Update connections and biases of simbrain network.


batchTrain

public void batchTrain()
Forwards to Snarli batchTrain() method.


batchIterate

public void batchIterate()
Batch train for one iteration.


randomize

public void randomize()
Randomize the network.


getEpochs

public int getEpochs()
Returns:
Returns the epochs.

setEpochs

public void setEpochs(int epochs)
Parameters:
epochs - The epochs to set.

getError

public double getError()
Returns:
Returns the error.

setError

public void setError(double error)
Parameters:
error - The error to set.

getErrorInterval

public int getErrorInterval()
Returns:
Returns the error_interval.

setErrorInterval

public void setErrorInterval(int errorInterval)
Parameters:
errorInterval - The errorInterval to set.

getEta

public double getEta()
Returns:
Returns the eta.

setEta

public void setEta(double eta)
Parameters:
eta - The eta to set.

getHid

public edu.wlu.cs.levy.SNARLI.BPLayer getHid()
Returns:
Returns the hid.

setHid

public void setHid(edu.wlu.cs.levy.SNARLI.BPLayer hid)
Parameters:
hid - The hid to set.

getInp

public edu.wlu.cs.levy.SNARLI.BPLayer getInp()
Returns:
Returns the inp.

setInp

public void setInp(edu.wlu.cs.levy.SNARLI.BPLayer inp)
Parameters:
inp - The inp to set.

getMu

public double getMu()
Returns:
Returns the mu.

setMu

public void setMu(double mu)
Parameters:
mu - The mu to set.

getNHidden

public int getNHidden()
Returns:
Returns the n_hidden.

setNHidden

public void setNHidden(int nHidden)
Parameters:
nHidden - The nHidden to set.

getNInputs

public int getNInputs()
Returns:
Returns the n_inputs.

setNInputs

public void setNInputs(int nInputs)
Parameters:
nInputs - The nInputs to set.

getNOutputs

public int getNOutputs()
Returns:
Returns the n_outputs.

setNOutputs

public void setNOutputs(int nOutputs)
Parameters:
nOutputs - The nOutputs to set.

getOut

public edu.wlu.cs.levy.SNARLI.BPLayer getOut()
Returns:
Returns the out.

setOut

public void setOut(edu.wlu.cs.levy.SNARLI.BPLayer out)
Parameters:
out - The out to set.

getTrainingInputs

public double[][] getTrainingInputs()
Returns:
Returns the training_inputs.

setTrainingInputs

public void setTrainingInputs(double[][] trainingInputs)
Parameters:
trainingInputs - The trainingInputs to set.

getTrainingOutputs

public double[][] getTrainingOutputs()
Returns:
Returns the trainingOutputs.

setTrainingOutputs

public void setTrainingOutputs(double[][] trainingOutputs)
Parameters:
trainingOutputs - The trainingOutputs to set.

getBiases

public double[] getBiases(StandardNetwork net)
Returns bias values.

Parameters:
net - Network
Returns:
Neuron biases

setBiases

public void setBiases(StandardNetwork net,
                      double[] biases)
Set bias values for all neurons in this network.

Parameters:
biases - Array of new bias values
net - Network to get biases

getTrainingINFile

public File getTrainingINFile()
Returns:
Returns the input training file.

setTrainingINFile

public void setTrainingINFile(File trainingINFile)
Sets the input training file.

Parameters:
trainingINFile - File to set input training

getTrainingOUTFile

public File getTrainingOUTFile()
Returns:
Returns the output training file.

setTrainingOUTFile

public void setTrainingOUTFile(File trainingOUTFile)
Sets the output training file.

Parameters:
trainingOUTFile - File to set output training