org.encog.neural.data.folded
Class FoldedDataSet

java.lang.Object
  extended by org.encog.neural.data.folded.FoldedDataSet
All Implemented Interfaces:
Iterable<NeuralDataPair>, EngineDataSet, EngineIndexableSet, Indexable, NeuralDataSet

public class FoldedDataSet
extends Object
implements Indexable

A folded data set allows you to "fold" the data into several equal(or nearly equal) datasets. You then have the ability to select which fold the dataset will process. This is very useful for crossvalidation. This dataset works off of an underlying dataset. By default there are no folds (fold size 1). Call the fold method to create more folds.


Field Summary
static String ADD_NOT_SUPPORTED
          Error message: adds are not supported.
 
Constructor Summary
FoldedDataSet(Indexable underlying)
          Create a folded dataset.
 
Method Summary
 void add(NeuralData data1)
          Not supported.
 void add(NeuralData inputData, NeuralData idealData)
          Not supported.
 void add(NeuralDataPair inputData)
          Not supported.
 void close()
          Close the dataset.
 void fold(int numFolds)
          Fold the dataset.
 int getCurrentFold()
           
 int getCurrentFoldOffset()
           
 int getCurrentFoldSize()
           
 int getIdealSize()
          
 int getInputSize()
          
 int getNumFolds()
           
 FoldedDataSet getOwner()
           
 void getRecord(long index, EngineData pair)
          Read an individual record, specified by index, in random order.
 long getRecordCount()
          Determine the total number of records in the set.
 Indexable getUnderlying()
           
 boolean isSupervised()
          
 Iterator<NeuralDataPair> iterator()
          
 EngineIndexableSet openAdditional()
          Opens an additional instance of this dataset.
 void setCurrentFold(int currentFold)
          Set the current fold.
 void setOwner(FoldedDataSet owner)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_NOT_SUPPORTED

public static final String ADD_NOT_SUPPORTED
Error message: adds are not supported.

See Also:
Constant Field Values
Constructor Detail

FoldedDataSet

public FoldedDataSet(Indexable underlying)
Create a folded dataset.

Parameters:
underlying - The underlying folded dataset.
Method Detail

add

public void add(NeuralData data1)
Not supported.

Specified by:
add in interface NeuralDataSet
Parameters:
data1 - Not used.

add

public void add(NeuralData inputData,
                NeuralData idealData)
Not supported.

Specified by:
add in interface NeuralDataSet
Parameters:
inputData - Not used.
idealData - Not used.

add

public void add(NeuralDataPair inputData)
Not supported.

Specified by:
add in interface NeuralDataSet
Parameters:
inputData - Not used.

close

public void close()
Close the dataset.

Specified by:
close in interface NeuralDataSet

fold

public void fold(int numFolds)
Fold the dataset. Must be done before the dataset is used.

Parameters:
numFolds - The number of folds.

getCurrentFold

public int getCurrentFold()
Returns:
the currentFold

getCurrentFoldOffset

public int getCurrentFoldOffset()
Returns:
the currentFoldOffset

getCurrentFoldSize

public int getCurrentFoldSize()
Returns:
the currentFoldSize

getIdealSize

public int getIdealSize()

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

getInputSize

public int getInputSize()

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

getNumFolds

public int getNumFolds()
Returns:
the numFolds

getRecord

public void getRecord(long index,
                      EngineData pair)
Read an individual record, specified by index, in random order.

Specified by:
getRecord in interface EngineIndexableSet
Parameters:
index - The index to read.
pair - The pair that the record will be copied into.

getRecordCount

public long getRecordCount()
Determine the total number of records in the set.

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

getUnderlying

public Indexable getUnderlying()
Returns:
The underlying dataset.

isSupervised

public boolean isSupervised()

Specified by:
isSupervised in interface EngineDataSet
Specified by:
isSupervised in interface NeuralDataSet
Returns:
True if this is a supervised training set.

getOwner

public FoldedDataSet getOwner()
Returns:
The owner.

setOwner

public void setOwner(FoldedDataSet owner)
Parameters:
owner - The owner.

iterator

public Iterator<NeuralDataPair> iterator()

Specified by:
iterator in interface Iterable<NeuralDataPair>

openAdditional

public EngineIndexableSet openAdditional()
Opens an additional instance of this dataset.

Specified by:
openAdditional in interface EngineIndexableSet
Returns:
The new instance.

setCurrentFold

public void setCurrentFold(int currentFold)
Set the current fold.

Parameters:
currentFold - the currentFold to set


Copyright © 2011. All Rights Reserved.