org.encog.neural.networks
Interface Network

All Superinterfaces:
EncogPersistedObject, EngineMachineLearning, Serializable
All Known Implementing Classes:
BasicNetwork, SVMNetwork

public interface Network
extends EncogPersistedObject, EngineMachineLearning

Interface that defines a neural network.

Author:
jheaton

Method Summary
 void addLayer(Layer layer)
          Add a layer to the neural network.
 void addLayer(Layer layer, SynapseType type)
          Add a layer to the neural network.
 double calculateError(NeuralDataSet data)
          Calculate the error for this neural network.
 int calculateNeuronCount()
          Calculate the total number of neurons in the network across all layers.
 Object clone()
          Return a clone of this neural network.
 NeuralData compute(NeuralData input)
          Compute the output for a given input to the neural network.
 NeuralData compute(NeuralData input, NeuralOutputHolder useHolder)
          Compute the output for a given input to the neural network.
 Persistor createPersistor()
          Create a persistor for this object.
 boolean equals(BasicNetwork other)
          Compare the two neural networks.
 boolean equals(BasicNetwork other, int precision)
          Determine if this neural network is equal to another.
 String getDescription()
           
 String getName()
           
 NeuralStructure getStructure()
           
 int getWeightMatrixSize()
           
 int hashCode()
          Generate a hash code.
 void reset()
          Reset the weight matrix and the bias values.
 void setDescription(String theDescription)
          Set the description for this object.
 void setName(String name)
          Set the name of this object.
 String toString()
          
 int winner(NeuralData input)
          Determine the winner for the specified input.
 
Methods inherited from interface org.encog.persist.EncogPersistedObject
getCollection, setCollection
 
Methods inherited from interface org.encog.engine.EngineMachineLearning
compute, getInputCount, getOutputCount
 

Method Detail

addLayer

void addLayer(Layer layer)
Add a layer to the neural network. The first layer added is the input layer, the last layer added is the output layer. This layer is added with a weighted synapse.

Parameters:
layer - The layer to be added.

addLayer

void addLayer(Layer layer,
              SynapseType type)
Add a layer to the neural network. If there are no layers added this layer will become the input layer. This function automatically updates both the input and output layer references.

Parameters:
layer - The layer to be added to the network.
type - What sort of synapse should connect this layer to the last.

calculateError

double calculateError(NeuralDataSet data)
Calculate the error for this neural network. The error is calculated using root-mean-square(RMS).

Parameters:
data - The training set.
Returns:
The error percentage.

calculateNeuronCount

int calculateNeuronCount()
Calculate the total number of neurons in the network across all layers.

Returns:
The neuron count.

clone

Object clone()
Return a clone of this neural network. Including structure, weights and bias values.

Returns:
A cloned copy of the neural network.

compute

NeuralData compute(NeuralData input)
Compute the output for a given input to the neural network.

Parameters:
input - The input to the neural network.
Returns:
The output from the neural network.

compute

NeuralData compute(NeuralData input,
                   NeuralOutputHolder useHolder)
Compute the output for a given input to the neural network. This method provides a parameter to specify an output holder to use. This holder allows propagation training to track the output from each layer. If you do not need this holder pass null, or use the other compare method.

Parameters:
input - The input provide to the neural network.
useHolder - Allows a holder to be specified, this allows propagation training to check the output of each layer.
Returns:
The results from the output neurons.

createPersistor

Persistor createPersistor()
Create a persistor for this object.

Specified by:
createPersistor in interface EncogPersistedObject
Returns:
The newly created persistor.

equals

boolean equals(BasicNetwork other)
Compare the two neural networks. For them to be equal they must be of the same structure, and have the same matrix values.

Parameters:
other - The other neural network.
Returns:
True if the two networks are equal.

equals

boolean equals(BasicNetwork other,
               int precision)
Determine if this neural network is equal to another. Equal neural networks have the same weight matrix and bias values, within a specified precision.

Parameters:
other - The other neural network.
precision - The number of decimal places to compare to.
Returns:
True if the two neural networks are equal.

getDescription

String getDescription()
Specified by:
getDescription in interface EncogPersistedObject
Returns:
The description for this object.

getName

String getName()
Specified by:
getName in interface EncogPersistedObject
Returns:
the name

getStructure

NeuralStructure getStructure()
Returns:
Get the structure of the neural network. The structure allows you to quickly obtain synapses and layers without traversing the network.

getWeightMatrixSize

int getWeightMatrixSize()
Returns:
The size of the matrix.

hashCode

int hashCode()
Generate a hash code.

Overrides:
hashCode in class Object
Returns:
THe hash code.

reset

void reset()
Reset the weight matrix and the bias values.


setDescription

void setDescription(String theDescription)
Set the description for this object.

Specified by:
setDescription in interface EncogPersistedObject
Parameters:
theDescription - The description.

setName

void setName(String name)
Description copied from interface: EncogPersistedObject
Set the name of this object.

Specified by:
setName in interface EncogPersistedObject
Parameters:
name - the name to set

toString

String toString()

Overrides:
toString in class Object

winner

int winner(NeuralData input)
Determine the winner for the specified input. This is the number of the winning neuron.

Parameters:
input - The input patter to present to the neural network.
Returns:
The winning neuron.


Copyright © 2011. All Rights Reserved.