org.vizzini.ai.neuralnetwork
Interface INeuralNetwork

All Superinterfaces:
Cloneable, Serializable
All Known Implementing Classes:
AbstractNeuralNetwork, DefaultNeuralNetwork, FeedForwardNetwork

public interface INeuralNetwork
extends Cloneable, Serializable

Defines methods required by a neural network.

Since:
v0.1
Version:
v0.3
Author:
Jeffrey M. Thompson

Method Summary
 void addConnector(IConnector connector)
          Add the given connector.
 void addLayer(ILayer layer)
          Add the given layer.
 void adjustWeights(int fromLayer, int toLayer, double[][] deltas)
          Adjust the given layer's weights by adding the given deltas.
 Object clone()
          Return a clone of this instance.
 void configure(Properties properties)
          Configure this object using the given properties.
 Iterator connectorIterator(String toLayerName)
          Return an iterator over the collection of connectors with the given to layer.
 double[] evaluate(double[] inputs)
          Apply the given inputs and return the output of the neural network.
 void fillWeights(double value)
          Assign the given value to all weights of the neural network.
 IActivationFunction getActivationFunction(int layerIndex)
          Return the activation function.
 Properties getConfiguration()
          Return the configuration of this network.
 IConnector getConnector(int fromLayerIndex, int toLayerIndex)
          Return the connector for the given parameters.
 int getConnectorCount()
          Return the number of connectors.
 IScaler getInputScaler()
          Return the input scaler.
 ILayer getLayer(int index)
          Return the layer at the given index.
 int getLayerCount()
          Return the number of layers.
 int getMaxOutputValueIndex()
          Return the index of the output node with the maximum value.
 double getNodeInput(int layer, int i)
          Return the node input value for the given parameters.
 double getNodeOutput(int layer, int i)
          Return the node output value for the given parameters.
 ILayer getOutputLayer()
          Return the output layer.
 int getOutputLayerIndex()
          Return the output layer index.
 double[] getOutputs()
          Return the output layer node values.
 IScaler getOutputScaler()
          Return the output scaler.
 double getWeight(int fromLayer, int i, int toLayer, int j)
          Return the weight for the given parameters.
 double[] getWeights(int fromLayer, int i, int toLayer)
          Return the weights for the given parameters.
 int indexOf(ILayer layer)
          Return the index of the given layer.
 boolean isConnected(ILayer fromLayer, ILayer toLayer)
          Return true if this network has a connector from the given layer to the given layer.
 boolean isConnected(int fromIndex, int toIndex)
          Return true if this network has a connector from the given layer to the given layer.
 void randomizeWeights()
          Assign random weights to the neural network.
 void randomizeWeights(double range)
          Assign random weights to the neural network.
 void setActivationFunction(IActivationFunction function)
          Set the activation function for the all layers of the network.
 void setActivationFunction(int layer, IActivationFunction function)
          Set the activation function for the given layer index.
 void setInputs(double[] inputs)
          Set the values of the input nodes.
 void setInputScaler(IScaler scaler)
          Set the input scaler.
 void setNodeInput(int layer, int i, double value)
          Set the node input value for the given parameters.
 void setOutputScaler(IScaler scaler)
          Set the output scaler.
 void setWeight(int fromLayer, int i, int toLayer, int j, double weight)
          Set the weight for the given parameters.
 void store(OutputStream outputStream)
          Store the neural network to the given output stream.
 String toString()
          Return a string representation of this object.
 void zeroWeights()
          Assign zero weights to the neural network.
 

Method Detail

addConnector

void addConnector(IConnector connector)
Add the given connector.

Parameters:
connector - Connector.
Since:
v0.3

addLayer

void addLayer(ILayer layer)
Add the given layer.

Parameters:
layer - Layer.
Since:
v0.3

adjustWeights

void adjustWeights(int fromLayer,
                   int toLayer,
                   double[][] deltas)
Adjust the given layer's weights by adding the given deltas.

Parameters:
fromLayer - From layer index, where 0=input layer, and layerCount-1=output layer.
toLayer - To layer index, where 0=input layer, and layerCount-1=output layer.
deltas - Weight deltas for the given layer.
Since:
v0.1

clone

Object clone()
Return a clone of this instance.

Since:
v0.1

configure

void configure(Properties properties)
               throws InstantiationException,
                      IllegalAccessException
Configure this object using the given properties.

Throws:
InstantiationException
IllegalAccessException
Since:
v0.1

connectorIterator

Iterator connectorIterator(String toLayerName)
Return an iterator over the collection of connectors with the given to layer.

Parameters:
toLayerName - To layer name.
Since:
v0.3

evaluate

double[] evaluate(double[] inputs)
Apply the given inputs and return the output of the neural network.

Since:
v0.1

fillWeights

void fillWeights(double value)
Assign the given value to all weights of the neural network.

Since:
v0.3

getActivationFunction

IActivationFunction getActivationFunction(int layerIndex)
Return the activation function.

Parameters:
layerIndex - Layer index, where 0=input layer, and layerCount-1=output layer.
Since:
v0.1

getConfiguration

Properties getConfiguration()
Return the configuration of this network.

Since:
v0.1

getConnector

IConnector getConnector(int fromLayerIndex,
                        int toLayerIndex)
Return the connector for the given parameters.

Parameters:
fromLayerIndex - From layer index.
toLayerIndex - To layer index.
Since:
v0.3

getConnectorCount

int getConnectorCount()
Return the number of connectors.

Since:
v0.3

getInputScaler

IScaler getInputScaler()
Return the input scaler.

Since:
v0.1

getLayer

ILayer getLayer(int index)
Return the layer at the given index.

Since:
v0.3

getLayerCount

int getLayerCount()
Return the number of layers.

Since:
v0.1

getMaxOutputValueIndex

int getMaxOutputValueIndex()
Return the index of the output node with the maximum value.

Since:
v0.1

getNodeInput

double getNodeInput(int layer,
                    int i)
Return the node input value for the given parameters.

Parameters:
layer - Layer index, where 0=input layer, and layerCount-1=output layer.
i - Node index.
Since:
v0.3

getNodeOutput

double getNodeOutput(int layer,
                     int i)
Return the node output value for the given parameters.

Parameters:
layer - Layer index, where 0=input layer, and layerCount-1=output layer.
i - Node index.
Since:
v0.3

getOutputLayer

ILayer getOutputLayer()
Return the output layer.

Since:
v0.3

getOutputLayerIndex

int getOutputLayerIndex()
Return the output layer index.

Since:
v0.3

getOutputs

double[] getOutputs()
Return the output layer node values.

Since:
v0.3

getOutputScaler

IScaler getOutputScaler()
Return the output scaler.

Since:
v0.1

getWeight

double getWeight(int fromLayer,
                 int i,
                 int toLayer,
                 int j)
Return the weight for the given parameters.

Parameters:
fromLayer - From layer index, where 0=input layer, and layerCount-1=output layer.
i - From layer node index.
toLayer - To layer index, where 0=input layer, and layerCount-1=output layer.
j - To layer node index.
Since:
v0.1

getWeights

double[] getWeights(int fromLayer,
                    int i,
                    int toLayer)
Return the weights for the given parameters.

Parameters:
fromLayer - From layer index, where 0=input layer, and layerCount-1=output layer.
i - From layer node index.
toLayer - To layer index, where 0=input layer, and layerCount-1=output layer.
Since:
v0.3

indexOf

int indexOf(ILayer layer)
Return the index of the given layer.

Since:
v0.3

isConnected

boolean isConnected(int fromIndex,
                    int toIndex)
Return true if this network has a connector from the given layer to the given layer.

Since:
v0.3

isConnected

boolean isConnected(ILayer fromLayer,
                    ILayer toLayer)
Return true if this network has a connector from the given layer to the given layer.

Since:
v0.3

randomizeWeights

void randomizeWeights()
Assign random weights to the neural network.

Since:
v0.1

randomizeWeights

void randomizeWeights(double range)
Assign random weights to the neural network.

Parameters:
range - ±Range of random weights around zero.
Since:
v0.3

setActivationFunction

void setActivationFunction(IActivationFunction function)
Set the activation function for the all layers of the network.

Since:
v0.1

setActivationFunction

void setActivationFunction(int layer,
                           IActivationFunction function)
Set the activation function for the given layer index.

Parameters:
layer - Layer index, where 0=input layer, and layerCount-1=output layer.
Since:
v0.3

setInputs

void setInputs(double[] inputs)
Set the values of the input nodes.

Since:
v0.3

setInputScaler

void setInputScaler(IScaler scaler)
Set the input scaler.

Since:
v0.1

setNodeInput

void setNodeInput(int layer,
                  int i,
                  double value)
Set the node input value for the given parameters.

Parameters:
layer - Layer index, where 0=input layer, and layerCount-1=output layer.
i - Node index.
Since:
v0.3

setOutputScaler

void setOutputScaler(IScaler scaler)
Set the output scaler.

Since:
v0.1

setWeight

void setWeight(int fromLayer,
               int i,
               int toLayer,
               int j,
               double weight)
Set the weight for the given parameters.

Parameters:
fromLayer - From layer index, where 0=input layer, and layerCount-1=output layer.
i - From layer node index.
toLayer - To layer index, where 0=input layer, and layerCount-1=output layer.
j - To layer node index.
weight - New weight.
Since:
v0.1

store

void store(OutputStream outputStream)
           throws IOException
Store the neural network to the given output stream.

Throws:
IOException
Since:
v0.1

toString

String toString()
Return a string representation of this object.

Overrides:
toString in class Object
Since:
v0.1

zeroWeights

void zeroWeights()
Assign zero weights to the neural network.

Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02