org.encog.neural.data.basic
Class BasicNeuralDataPair

java.lang.Object
  extended by org.encog.neural.data.basic.BasicNeuralDataPair
All Implemented Interfaces:
Serializable, EngineData, NeuralDataPair

public class BasicNeuralDataPair
extends Object
implements NeuralDataPair, Serializable

A basic implementation of the NeuralDataPair interface. This implementation simply holds and input and ideal NeuralData object. For supervised training both input and ideal should be specified. For unsupervised training the input property should be valid, however the ideal property should contain null.

Author:
jheaton
See Also:
Serialized Form

Constructor Summary
BasicNeuralDataPair(NeuralData input)
          Construct the object with only input.
BasicNeuralDataPair(NeuralData input, NeuralData ideal)
          Construct a BasicNeuralDataPair class with the specified input and ideal values.
 
Method Summary
static NeuralDataPair createPair(int inputSize, int idealSize)
          Create a new neural data pair object of the correct size for the neural network that is being trained.
 NeuralData getIdeal()
          Get the expected results.
 double[] getIdealArray()
           
 NeuralData getInput()
          Get the input data.
 double[] getInputArray()
           
 boolean isSupervised()
          Determine if this data pair is supervised.
 void setIdealArray(double[] data)
          Set the ideal data, the desired output.
 void setInputArray(double[] data)
          Set the input.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicNeuralDataPair

public BasicNeuralDataPair(NeuralData input)
Construct the object with only input. If this constructor is used, then unsupervised training is being used.

Parameters:
input - The input to the neural network.

BasicNeuralDataPair

public BasicNeuralDataPair(NeuralData input,
                           NeuralData ideal)
Construct a BasicNeuralDataPair class with the specified input and ideal values.

Parameters:
input - The input to the neural network.
ideal - The expected results from the neural network.
Method Detail

getIdeal

public NeuralData getIdeal()
Get the expected results. Returns null if this is unsupervised training.

Specified by:
getIdeal in interface NeuralDataPair
Returns:
Returns the expected results, or null if unsupervised training.

getInput

public NeuralData getInput()
Get the input data.

Specified by:
getInput in interface NeuralDataPair
Returns:
The input data.

isSupervised

public boolean isSupervised()
Determine if this data pair is supervised.

Specified by:
isSupervised in interface EngineData
Specified by:
isSupervised in interface NeuralDataPair
Returns:
True if this data pair is supervised.

toString

public String toString()

Overrides:
toString in class Object

createPair

public static NeuralDataPair createPair(int inputSize,
                                        int idealSize)
Create a new neural data pair object of the correct size for the neural network that is being trained. This object will be passed to the getPair method to allow the neural data pair objects to be copied to it.

Parameters:
inputSize - The size of the input data.
idealSize - The size of the ideal data.
Returns:
A new neural data pair object.

getIdealArray

public double[] getIdealArray()
Specified by:
getIdealArray in interface EngineData
Returns:
The ideal data that the neural network should produce for the specified input.

getInputArray

public double[] getInputArray()
Specified by:
getInputArray in interface EngineData
Returns:
The input that the neural network

setIdealArray

public void setIdealArray(double[] data)
Description copied from interface: EngineData
Set the ideal data, the desired output.

Specified by:
setIdealArray in interface EngineData
Parameters:
data - The ideal data.

setInputArray

public void setInputArray(double[] data)
Description copied from interface: EngineData
Set the input.

Specified by:
setInputArray in interface EngineData
Parameters:
data - The input.


Copyright © 2011. All Rights Reserved.