Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.neuroph.core
Class NeuralNetwork

    java.lang.Object
      java.util.Observable
          org.neuroph.core.NeuralNetwork

All Implemented Interfaces:
  java.io.Serializable, java.lang.Runnable

Direct Known Subclasses:
  Adaline, BAM, CompetitiveNetwork, Hopfield, IACNetwork, Instar, Kohonen, MaxNet, MultiLayerPerceptron, NeuroFuzzyPerceptron, Outstar, Perceptron, RbfNetwork, RecommenderNetwork, SupervisedHebbianNetwork, UnsupervisedHebbianNetwork

    public class NeuralNetwork

extends java.util.Observable
implements java.lang.Runnable, java.io.Serializable

     Base class for artificial neural networks. It provides generic structure and functionality
     for the neural networks. Neural network contains a collection of neuron layers and learning rule.
     Custom neural networks are created by deriving from this class, creating layers of interconnected network specific neurons,
     and setting network specific learning rule.

See Also:
  `Layer`, `LearningRule`, Serialized Form

Constructor Summary
`NeuralNetwork()` Creates an instance of empty neural network.

Method Summary
`void` | `addLayer(int idx, Layer layer)` Adds layer to specified index position in network
`void` | `addLayer(Layer layer)` Adds layer to neural network
`void` | `addPlugin(PluginBase plugin)` Adds plugin to neural network
`void` | `calculate()` Performs calculation on whole network
`void` | `createConnection(Neuron fromNeuron, Neuron toNeuron, double weightVal)` Creates connection with specified weight value between specified neurons
`java.util.Vector<Neuron>` | `getInputNeurons()` Gets reference to input neurons Vector.
`Layer` | `getLayerAt(int idx)` Returns layer at specified index
`java.util.Vector<Layer>` | `getLayers()` Returns getLayersIterator Vector collection
`int` | `getLayersCount()` Returns number of layers in network
`java.util.Iterator<Layer>` | `getLayersIterator()` Returns interface for iterating layers
`LearningRule` | `getLearningRule()` Returns the learning algorithm of this network
`NeuralNetworkType` | `getNetworkType()` Returns type of this network
`java.util.Vector<java.lang.Double>` | `getOutput()` Returns network output Vector.
`double[]` | `getOutputAsArray()` Returns network output vector as double array
`java.util.Vector<Neuron>` | `getOutputNeurons()` Returns reference to output neurons Vector.
`PluginBase` | `getPlugin(java.lang.String pluginName)` Returns the requested plugin
`int` | `indexOf(Layer layer)` Returns index position of the specified layer
`void` | `learn(TrainingSet trainingSetToLearn)` Deprecated.
`void` | `learnInNewThread(TrainingSet trainingSetToLearn)` Starts learning in a new thread to learn the specified training set, and immediately returns from method to the current thread execution
`void` | `learnInNewThread(TrainingSet trainingSetToLearn, LearningRule learningRule)` Starts learning with specified learning rule in new thread to learn the specified training set, and immediately returns from method to the current thread execution
`void` | `learnInSameThread(TrainingSet trainingSetToLearn)` Starts the learning in the current running thread to learn the specified training set, and returns from method when network is done learning
`void` | `learnInSameThread(TrainingSet trainingSetToLearn, LearningRule learningRule)` Starts the learning with specified learning rule in the current running thread to learn the specified training set, and returns from method when network is done learning
`static NeuralNetwork` | `load(java.lang.String filePath)` Loads neural network from the specified file.
`void` | `notifyChange()` Notifies observers about some change
`void` | `randomizeWeights()` Randomizes connection weights for the whole network
`void` | `removeLayer(Layer layer)` Removes specified layer from network
`void` | `removeLayerAt(int idx)` Removes layer at specified index position from net
`void` | `removePlugin(java.lang.String pluginName)` Removes the plugin with specified name
`void` | `reset()` Resets the activation levels for whole network
`void` | `run()` Implementation of Runnable interface for calculating network in the separate thread.
`void` | `save(java.lang.String filePath)` Saves neural network into the specified file.
`void` | `setInput(double... inputArray)` Sets network input.
`void` | `setInput(java.util.Vector<java.lang.Double> inputVector)` Sets network input.
`void` | `setInputNeurons(java.util.Vector<Neuron> inputNeurons)` Sets reference to input neurons Vector
`void` | `setLearningRule(LearningRule learningRule)` Sets learning algorithm for this network
`void` | `setNetworkType(NeuralNetworkType type)` Sets type for this network
`void` | `setOutputNeurons(java.util.Vector<Neuron> outputNeurons)` Sets reference to output neurons Vector.
`void` | `stopLearning()` Stops learning
`java.lang.String` | `toString()`

Methods inherited from class java.util.Observable
`addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NeuralNetwork

    public NeuralNetwork()

  Creates an instance of empty neural network.

Method Detail

### addLayer

    public void addLayer(Layer layer)

  Adds layer to neural network

  Parameters:
    `layer` - layer to add

### addLayer

    public void addLayer(int idx,
                         Layer layer)

  Adds layer to specified index position in network

  Parameters:
    `idx` - index position to add layer
    `layer` - layer to add

### removeLayer

    public void removeLayer(Layer layer)

  Removes specified layer from network

  Parameters:
    `layer` - layer to remove

### removeLayerAt

    public void removeLayerAt(int idx)

  Removes layer at specified index position from net

  Parameters:
    `idx` - int value represents index postion of layer which should be removed

### getLayersIterator

    public java.util.Iterator<Layer> getLayersIterator()

  Returns interface for iterating layers

  Returns:
    iterator interface for network getLayersIterator

### getLayers

    public java.util.Vector<Layer> getLayers()

  Returns getLayersIterator Vector collection

  Returns:
    getLayersIterator Vector collection

### getLayerAt

    public Layer getLayerAt(int idx)

  Returns layer at specified index

  Parameters:
    `idx` - layer index position
  Returns:
    layer at specified index position

### indexOf

    public int indexOf(Layer layer)

  Returns index position of the specified layer

  Parameters:
    `layer` - requested Layer object
  Returns:
    layer position index

### getLayersCount

    public int getLayersCount()

  Returns number of layers in network

  Returns:
    number of layes in net

### setInput

    public void setInput(java.util.Vector<java.lang.Double> inputVector)

  Sets network input. Input Vector is collection of Double values.

  Parameters:
    `inputVector` - network input vector

### setInput

    public void setInput(double... inputArray)

  Sets network input. Input is array of double values.

  Parameters:
    `inputArray` - network input as double array

### getOutput

    public java.util.Vector<java.lang.Double> getOutput()

  Returns network output Vector. Output Vector is a collection of Double values.

  Returns:
    network output Vector

### getOutputAsArray

    public double[] getOutputAsArray()

  Returns network output vector as double array

  Returns:
    network output vector as double array

### calculate

    public void calculate()

  Performs calculation on whole network

### reset

    public void reset()

  Resets the activation levels for whole network

### run

    public void run()

  Implementation of Runnable interface for calculating network in the separate thread.

  Specified by:
    `run` in interface `java.lang.Runnable`

### learn

    public void learn(TrainingSet trainingSetToLearn)

  Deprecated.

  Trains the network to learn the specified training set. This method is deprecated use learnInNewThread or learnInSameThread instead.

  Parameters:
    `trainingSetToLearn` - set of training elements to learn

### learnInNewThread

    public void learnInNewThread(TrainingSet trainingSetToLearn)

  Starts learning in a new thread to learn the specified training set, and immediately returns from method to the current thread execution

  Parameters:
    `trainingSetToLearn` - set of training elements to learn

### learnInNewThread

    public void learnInNewThread(TrainingSet trainingSetToLearn,
                                 LearningRule learningRule)

  Starts learning with specified learning rule in new thread to learn the specified training set, and immediately returns from method to the current thread execution

  Parameters:
    `trainingSetToLearn` - set of training elements to learn
    `learningRule` - learning algorithm

### learnInSameThread

    public void learnInSameThread(TrainingSet trainingSetToLearn)

  Starts the learning in the current running thread to learn the specified training set, and returns from method when network is done learning

  Parameters:
    `trainingSetToLearn` - set of training elements to learn

### learnInSameThread

    public void learnInSameThread(TrainingSet trainingSetToLearn,
                                  LearningRule learningRule)

  Starts the learning with specified learning rule in the current running thread to learn the specified training set, and returns from method when network is done learning

  Parameters:
    `trainingSetToLearn` - set of training elements to learn
    `learningRule` - learning algorithm *

### stopLearning

    public void stopLearning()

  Stops learning

### randomizeWeights

    public void randomizeWeights()

  Randomizes connection weights for the whole network

### getNetworkType

    public NeuralNetworkType getNetworkType()

  Returns type of this network

  Returns:
    network type

### setNetworkType

    public void setNetworkType(NeuralNetworkType type)

  Sets type for this network

  Parameters:
    `type` - network type

### getInputNeurons

    public java.util.Vector<Neuron> getInputNeurons()

  Gets reference to input neurons Vector.

  Returns:
    input neurons Vector

### setInputNeurons

    public void setInputNeurons(java.util.Vector<Neuron> inputNeurons)

  Sets reference to input neurons Vector

  Parameters:
    `inputNeurons` - input neurons collection

### getOutputNeurons

    public java.util.Vector<Neuron> getOutputNeurons()

  Returns reference to output neurons Vector.

  Returns:
    output neurons Vector

### setOutputNeurons

    public void setOutputNeurons(java.util.Vector<Neuron> outputNeurons)

  Sets reference to output neurons Vector.

  Parameters:
    `outputNeurons` - output neurons collection

### getLearningRule

    public LearningRule getLearningRule()

  Returns the learning algorithm of this network

  Returns:
    algorithm for network training

### setLearningRule

    public void setLearningRule(LearningRule learningRule)

  Sets learning algorithm for this network

  Parameters:
    `learningRule` - learning algorithm for this network

### notifyChange

    public void notifyChange()

  Notifies observers about some change

### createConnection

    public void createConnection(Neuron fromNeuron,
                                 Neuron toNeuron,
                                 double weightVal)

  Creates connection with specified weight value between specified neurons

  Parameters:
    `fromNeuron` - neuron to connect
    `toNeuron` - neuron to connect to
    `weightVal` - connection weight value

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### save

    public void save(java.lang.String filePath)

  Saves neural network into the specified file.

  Parameters:
    `filePath` - file path to save network into

### load

    public static NeuralNetwork load(java.lang.String filePath)

  Loads neural network from the specified file.

  Parameters:
    `filePath` - file path to load network from
  Returns:
    loaded neural network as NeuralNetwork object

### addPlugin

    public void addPlugin(PluginBase plugin)

  Adds plugin to neural network

  Parameters:
    `plugin` - neural network plugin to add

### getPlugin

    public PluginBase getPlugin(java.lang.String pluginName)

  Returns the requested plugin

  Parameters:
    `pluginName` - name of the plugin to get
  Returns:
    plugin with specified name

### removePlugin

    public void removePlugin(java.lang.String pluginName)

  Removes the plugin with specified name

  Parameters:
    `pluginName` - name of the plugin to remove

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Neuroph
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD