org.encog.neural.data.basic
Class BasicNeuralDataSet

java.lang.Object
  extended by org.encog.neural.data.basic.BasicNeuralDataSet
All Implemented Interfaces:
Serializable, Iterable<NeuralDataPair>, EngineDataSet, EngineIndexableSet, Indexable, NeuralDataSet, EncogPersistedObject
Direct Known Subclasses:
ImageNeuralDataSet, TemporalNeuralDataSet

public class BasicNeuralDataSet
extends Object
implements EncogPersistedObject, Serializable, Indexable

neural data in an ArrayList. This class is memory based, so large enough datasets could cause memory issues. Many other dataset types extend this class.

Author:
jheaton
See Also:
Serialized Form

Nested Class Summary
 class BasicNeuralDataSet.BasicNeuralIterator
          An iterator to be used with the BasicNeuralDataSet.
 
Constructor Summary
BasicNeuralDataSet()
          Default constructor.
BasicNeuralDataSet(double[][] input, double[][] ideal)
          Construct a data set from an input and idea array.
BasicNeuralDataSet(List<NeuralDataPair> data)
          Construct a data set from an already created list.
 
Method Summary
 void add(NeuralData data)
          Add input to the training set with no expected output.
 void add(NeuralData inputData, NeuralData idealData)
          Add input and expected output.
 void add(NeuralDataPair inputData)
          Add a neural data pair to the list.
 Object clone()
           
 void close()
          Close this data set.
 Persistor createPersistor()
          Create a persistor for this object.
 EncogCollection getCollection()
           
 List<NeuralDataPair> getData()
          Get the data held by this container.
 String getDescription()
           
 int getIdealSize()
          Get the size of the ideal dataset.
 int getInputSize()
          Get the size of the input dataset.
 String getName()
           
 void getRecord(long index, EngineData pair)
          Get a record by index into the specified pair.
 long getRecordCount()
          Determine the total number of records in the set.
 boolean isSupervised()
          Determine if this neural data set is supervied.
 Iterator<NeuralDataPair> iterator()
          Create an iterator for this collection.
 Indexable openAdditional()
          Create an additional data set.
 void setCollection(EncogCollection collection)
          Set the Encog collection that this object belongs to.
 void setData(List<NeuralDataPair> data)
           
 void setDescription(String description)
          Set the description of this object.
 void setName(String name)
          Set the name of this object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicNeuralDataSet

public BasicNeuralDataSet()
Default constructor.


BasicNeuralDataSet

public BasicNeuralDataSet(double[][] input,
                          double[][] ideal)
Construct a data set from an input and idea array.

Parameters:
input - The input into the neural network for training.
ideal - The ideal output for training.

BasicNeuralDataSet

public BasicNeuralDataSet(List<NeuralDataPair> data)
Construct a data set from an already created list. Mostly used to duplicate this class.

Parameters:
data - The data to use.
Method Detail

add

public void add(NeuralData data)
Add input to the training set with no expected output. This is used for unsupervised training.

Specified by:
add in interface NeuralDataSet
Parameters:
data - The input to be added to the training set.

add

public void add(NeuralData inputData,
                NeuralData idealData)
Add input and expected output. This is used for supervised training.

Specified by:
add in interface NeuralDataSet
Parameters:
inputData - The input data to train on.
idealData - The ideal data to use for training.

add

public void add(NeuralDataPair inputData)
Add a neural data pair to the list.

Specified by:
add in interface NeuralDataSet
Parameters:
inputData - A NeuralDataPair object that contains both input and ideal data.

clone

public Object clone()
Overrides:
clone in class Object
Returns:
A cloned copy of this object.

close

public void close()
Close this data set.

Specified by:
close in interface NeuralDataSet

createPersistor

public Persistor createPersistor()
Create a persistor for this object.

Specified by:
createPersistor in interface EncogPersistedObject
Returns:
A persistor for this object.

getData

public List<NeuralDataPair> getData()
Get the data held by this container.

Returns:
the data

getDescription

public String getDescription()
Specified by:
getDescription in interface EncogPersistedObject
Returns:
the description

getIdealSize

public int getIdealSize()
Get the size of the ideal dataset. This is obtained from the first item in the list.

Specified by:
getIdealSize in interface EngineDataSet
Specified by:
getIdealSize in interface NeuralDataSet
Returns:
The size of the ideal data.

getInputSize

public int getInputSize()
Get the size of the input dataset. This is obtained from the first item in the list.

Specified by:
getInputSize in interface EngineDataSet
Specified by:
getInputSize in interface NeuralDataSet
Returns:
The size of the input data.

getName

public String getName()
Specified by:
getName in interface EncogPersistedObject
Returns:
the name

getRecord

public void getRecord(long index,
                      EngineData pair)
Get a record by index into the specified pair.

Specified by:
getRecord in interface EngineIndexableSet
Parameters:
index - The index to read.
pair - The pair to hold the data.

getRecordCount

public long getRecordCount()
Description copied from interface: EngineIndexableSet
Determine the total number of records in the set.

Specified by:
getRecordCount in interface EngineIndexableSet
Returns:
The total number of records in the file.

isSupervised

public boolean isSupervised()
Determine if this neural data set is supervied. All of the pairs should be either supervised or not, so simply check the first pair. If the list is empty then assume unsupervised.

Specified by:
isSupervised in interface EngineDataSet
Specified by:
isSupervised in interface NeuralDataSet
Returns:
True if supervised.

iterator

public Iterator<NeuralDataPair> iterator()
Create an iterator for this collection.

Specified by:
iterator in interface Iterable<NeuralDataPair>
Returns:
An iterator to access this collection.

openAdditional

public Indexable openAdditional()
Create an additional data set. It will use the same list.

Specified by:
openAdditional in interface EngineIndexableSet
Returns:
The additional data set.

setData

public void setData(List<NeuralDataPair> data)
Parameters:
data - the data to set

setDescription

public void setDescription(String description)
Description copied from interface: EncogPersistedObject
Set the description of this object.

Specified by:
setDescription in interface EncogPersistedObject
Parameters:
description - the description to set

setName

public void setName(String name)
Description copied from interface: EncogPersistedObject
Set the name of this object.

Specified by:
setName in interface EncogPersistedObject
Parameters:
name - the name to set

getCollection

public EncogCollection getCollection()
Specified by:
getCollection in interface EncogPersistedObject
Returns:
The collection this Encog object belongs to, null if none.

setCollection

public void setCollection(EncogCollection collection)
Set the Encog collection that this object belongs to.

Specified by:
setCollection in interface EncogPersistedObject


Copyright © 2011. All Rights Reserved.