org.encog.ml.data.folded
Class FoldedDataSet

java.lang.Object
  extended by org.encog.ml.data.folded.FoldedDataSet
All Implemented Interfaces:
Iterable<MLDataPair>, MLDataSet

public class FoldedDataSet
extends Object
implements MLDataSet

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(MLDataSet theUnderlying)
          Create a folded dataset.
 
Method Summary
 void add(MLData data1)
          Not supported.
 void add(MLData inputData, MLData idealData)
          Not supported.
 void add(MLDataPair inputData)
          Not supported.
 void close()
          Close the dataset.
 void fold(int theNumFolds)
          Fold the dataset.
 MLDataPair get(int index)
           
 int getCurrentFold()
           
 int getCurrentFoldOffset()
           
 int getCurrentFoldSize()
           
 int getIdealSize()
          
 int getInputSize()
          
 int getNumFolds()
           
 FoldedDataSet getOwner()
           
 void getRecord(long index, MLDataPair pair)
          Read an individual record, specified by index, in random order.
 long getRecordCount()
          Determine the total number of records in the set.
 MLDataSet getUnderlying()
           
 boolean isSupervised()
          
 Iterator<MLDataPair> iterator()
          
 MLDataSet openAdditional()
          Opens an additional instance of this dataset.
 void setCurrentFold(int theCurrentFold)
          Set the current fold.
 void setOwner(FoldedDataSet theOwner)
           
 int size()
           
 
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(MLDataSet theUnderlying)
Create a folded dataset.

Parameters:
theUnderlying - The underlying folded dataset.
Method Detail

add

public void add(MLData data1)
Not supported.

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

add

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

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

add

public void add(MLDataPair inputData)
Not supported.

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

close

public void close()
Close the dataset.

Specified by:
close in interface MLDataSet

fold

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

Parameters:
theNumFolds - 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 MLDataSet
Returns:
The size of the ideal data.

getInputSize

public int getInputSize()

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

getNumFolds

public int getNumFolds()
Returns:
the numFolds

getOwner

public FoldedDataSet getOwner()
Returns:
The owner.

getRecord

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

Specified by:
getRecord in interface MLDataSet
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 MLDataSet
Returns:
The total number of records in the set.

getUnderlying

public MLDataSet getUnderlying()
Returns:
The underlying dataset.

isSupervised

public boolean isSupervised()

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

iterator

public Iterator<MLDataPair> iterator()

Specified by:
iterator in interface Iterable<MLDataPair>

openAdditional

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

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

setCurrentFold

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

Parameters:
theCurrentFold - the currentFold to set

setOwner

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

size

public int size()
Specified by:
size in interface MLDataSet

get

public MLDataPair get(int index)
Specified by:
get in interface MLDataSet


Copyright © 2014. All Rights Reserved.