org.encog.ml.data.basic
Class BasicMLDataPair

java.lang.Object
  extended by org.encog.ml.data.basic.BasicMLDataPair
All Implemented Interfaces:
Serializable, MLDataPair, CentroidFactory<MLDataPair>
Direct Known Subclasses:
BasicNeuralDataPair

public class BasicMLDataPair
extends Object
implements MLDataPair, Serializable

A basic implementation of the MLDataPair interface. This implementation simply holds and input and ideal MLData 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
BasicMLDataPair(MLData theInput)
          Construct the object with only input.
BasicMLDataPair(MLData theInput, MLData theIdeal)
          Construct a BasicMLDataPair class with the specified input and ideal values.
 
Method Summary
 Centroid<MLDataPair> createCentroid()
          
static MLDataPair createPair(int inputSize, int idealSize)
          Create a new data pair object of the correct size for the machine learning method that is being trained.
 MLData getIdeal()
          
 double[] getIdealArray()
          
 MLData getInput()
          
 double[] getInputArray()
          
 double getSignificance()
          Get the significance, 1.0 is neutral.
 boolean isSupervised()
          
 void setIdealArray(double[] data)
          Set the ideal data, the desired output.
 void setInputArray(double[] data)
          Set the input.
 void setSignificance(double significance)
          Set the significance, 1.0 is neutral.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicMLDataPair

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

Parameters:
theInput - The input to the machine learning method.

BasicMLDataPair

public BasicMLDataPair(MLData theInput,
                       MLData theIdeal)
Construct a BasicMLDataPair class with the specified input and ideal values.

Parameters:
theInput - The input to the machine learning method.
theIdeal - The expected results from the machine learning method.
Method Detail

createPair

public static MLDataPair createPair(int inputSize,
                                    int idealSize)
Create a new data pair object of the correct size for the machine learning method that is being trained. This object will be passed to the getPair method to allow the 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 data pair object.

getIdeal

public MLData getIdeal()

Specified by:
getIdeal in interface MLDataPair
Returns:
The ideal data that the neural network should produce for the specified input.

getIdealArray

public double[] getIdealArray()

Specified by:
getIdealArray in interface MLDataPair
Returns:
The ideal data that the machine learning method should produce for the specified input.

getInput

public MLData getInput()

Specified by:
getInput in interface MLDataPair
Returns:
The input that the neural network

getInputArray

public double[] getInputArray()

Specified by:
getInputArray in interface MLDataPair
Returns:
The input that the neural network

isSupervised

public boolean isSupervised()

Specified by:
isSupervised in interface MLDataPair
Returns:
True if this training pair is supervised. That is, it has both input and ideal data.

setIdealArray

public void setIdealArray(double[] data)
Set the ideal data, the desired output.

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

setInputArray

public void setInputArray(double[] data)
Set the input.

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

toString

public String toString()

Overrides:
toString in class Object

getSignificance

public double getSignificance()
Get the significance, 1.0 is neutral.

Specified by:
getSignificance in interface MLDataPair
Returns:
The significance.

setSignificance

public void setSignificance(double significance)
Set the significance, 1.0 is neutral.

Specified by:
setSignificance in interface MLDataPair
Parameters:
significance - The significance.

createCentroid

public Centroid<MLDataPair> createCentroid()

Specified by:
createCentroid in interface CentroidFactory<MLDataPair>
Returns:
The centroid.


Copyright © 2014. All Rights Reserved.