Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

AI.NeuralNetworks
Class FeedForwardNetwork  view FeedForwardNetwork download FeedForwardNetwork.java

java.lang.Object
  extended byAI.NeuralNetworks.FeedForwardNetwork
Direct Known Subclasses:
BackErrorPropagation

public class FeedForwardNetwork
extends java.lang.Object

This Class is a nerual network with a multiple layer feed forward architecture


Field Summary
protected static java.lang.String COMMENT_TOKEN
           
protected static java.lang.String HEXADECIMAL_VERSION
           
protected static java.lang.String INPUT_LAYER_TOKEN
           
protected  java.util.LinkedList layers
           
protected static java.lang.String NUMBER_OF_LAYERS_TOKEN
           
protected static java.lang.String VERSION
           
protected static java.lang.String VERSION_TOKEN
           
protected static java.lang.String WEIGHTED_LAYER_TOKEN
           
protected static java.lang.String WEIGHTS_TOKEN
           
 
Constructor Summary
protected FeedForwardNetwork()
          Creates a new FeedForwardNetwork This constructor should be only used by sublcases
  FeedForwardNetwork(java.io.BufferedReader input)
          Creates a new FeedForwardNetwork form the specified BufferedReader
  FeedForwardNetwork(int[] structure)
          Creates a new FeedForwardNetwork
  FeedForwardNetwork(int[] netIntArray, int chanchada)
          Creates a new FeedForwardNetwork form the specified BufferedReader
  FeedForwardNetwork(java.lang.String fileName)
          Creates a new FeedForwardNetwork form the specified file
 
Method Summary
private static int[] addIntToArray(int[] array, int element, int pos)
           
private static float[][] createWeights(java.io.BufferedReader input, int layerSize, int previousLayerSize)
           
private static java.util.StringTokenizer getNextStringTokenizer(java.io.BufferedReader input, java.lang.String token)
           
 int inputSize()
          returns the number of inputs of the net without counting the bias
 int[] netToIntArrey()
          returns a int[] which represents a netework the weightValues are converted to int with the Float.floatToIntBits() method.
 int outputSize()
          returns the number of outputs of the net without counting the bias
 float[] runVector(float[] inputVector)
          Runs the network with the inputVector and returns the outputVector
 void save(java.io.BufferedWriter output)
          Saves the neural network
 void saveToFile(java.lang.String fileName)
          Saves the neural network
 java.lang.String toString()
          retrurns a String representation of the net
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

layers

protected java.util.LinkedList layers

COMMENT_TOKEN

protected static final java.lang.String COMMENT_TOKEN
See Also:
Constant Field Values

NUMBER_OF_LAYERS_TOKEN

protected static final java.lang.String NUMBER_OF_LAYERS_TOKEN
See Also:
Constant Field Values

INPUT_LAYER_TOKEN

protected static final java.lang.String INPUT_LAYER_TOKEN
See Also:
Constant Field Values

WEIGHTED_LAYER_TOKEN

protected static final java.lang.String WEIGHTED_LAYER_TOKEN
See Also:
Constant Field Values

WEIGHTS_TOKEN

protected static final java.lang.String WEIGHTS_TOKEN
See Also:
Constant Field Values

VERSION_TOKEN

protected static final java.lang.String VERSION_TOKEN
See Also:
Constant Field Values

VERSION

protected static final java.lang.String VERSION
See Also:
Constant Field Values

HEXADECIMAL_VERSION

protected static final java.lang.String HEXADECIMAL_VERSION
See Also:
Constant Field Values
Constructor Detail

FeedForwardNetwork

protected FeedForwardNetwork()
Creates a new FeedForwardNetwork This constructor should be only used by sublcases


FeedForwardNetwork

public FeedForwardNetwork(int[] structure)
Creates a new FeedForwardNetwork


FeedForwardNetwork

public FeedForwardNetwork(java.lang.String fileName)
                   throws java.io.IOException
Creates a new FeedForwardNetwork form the specified file


FeedForwardNetwork

public FeedForwardNetwork(java.io.BufferedReader input)
                   throws java.io.IOException,
                          java.lang.NumberFormatException
Creates a new FeedForwardNetwork form the specified BufferedReader


FeedForwardNetwork

public FeedForwardNetwork(int[] netIntArray,
                          int chanchada)
                   throws java.io.IOException,
                          java.lang.NumberFormatException
Creates a new FeedForwardNetwork form the specified BufferedReader

Method Detail

runVector

public float[] runVector(float[] inputVector)
                  throws UnexpectedInputArraySizeException
Runs the network with the inputVector and returns the outputVector


saveToFile

public void saveToFile(java.lang.String fileName)
                throws java.io.IOException
Saves the neural network


save

public void save(java.io.BufferedWriter output)
          throws java.io.IOException
Saves the neural network


toString

public java.lang.String toString()
retrurns a String representation of the net


inputSize

public int inputSize()
returns the number of inputs of the net without counting the bias


outputSize

public int outputSize()
returns the number of outputs of the net without counting the bias


getNextStringTokenizer

private static java.util.StringTokenizer getNextStringTokenizer(java.io.BufferedReader input,
                                                                java.lang.String token)
                                                         throws java.io.IOException,
                                                                java.util.NoSuchElementException

createWeights

private static float[][] createWeights(java.io.BufferedReader input,
                                       int layerSize,
                                       int previousLayerSize)
                                throws java.io.IOException,
                                       java.util.NoSuchElementException

netToIntArrey

public int[] netToIntArrey()
returns a int[] which represents a netework the weightValues are converted to int with the Float.floatToIntBits() method.


addIntToArray

private static int[] addIntToArray(int[] array,
                                   int element,
                                   int pos)