org.encog.ml.data.basic
Class BasicMLDataSet

java.lang.Object
  extended by org.encog.ml.data.basic.BasicMLDataSet
All Implemented Interfaces:
Serializable, Iterable<MLDataPair>, MLDataSet
Direct Known Subclasses:
BasicNeuralDataSet, CSVNeuralDataSet, ImageMLDataSet, SQLNeuralDataSet

public class BasicMLDataSet
extends Object
implements Serializable, MLDataSet

Stores 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 BasicMLDataSet.BasicMLIterator
          An iterator to be used with the BasicMLDataSet.
 
Constructor Summary
BasicMLDataSet()
          Default constructor.
BasicMLDataSet(double[][] input, double[][] ideal)
          Construct a data set from an input and idea array.
BasicMLDataSet(List<MLDataPair> theData)
          Construct a data set from an already created list.
BasicMLDataSet(MLDataSet set)
          Copy whatever dataset type is specified into a memory dataset.
 
Method Summary
 void add(MLData theData)
          Add a object to the dataset.
 void add(MLData inputData, MLData idealData)
          Add a set of input and ideal data to the dataset.
 void add(MLDataPair inputData)
          Add a an object to the dataset.
 Object clone()
          
 void close()
          Close this datasource and release any resources obtained by it, including any iterators created.
 MLDataPair get(int index)
          
 List<MLDataPair> getData()
          Get the data held by this container.
 int getIdealSize()
          
 int getInputSize()
          
 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.
 boolean isSupervised()
          
 Iterator<MLDataPair> iterator()
          
 MLDataSet openAdditional()
          Opens an additional instance of this dataset.
 void setData(List<MLDataPair> theData)
           
 int size()
          
static List<MLDataPair> toList(MLDataSet theSet)
          Concert the data set to a list.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMLDataSet

public BasicMLDataSet()
Default constructor.


BasicMLDataSet

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

Parameters:
input - The input into the machine learning method for training.
ideal - The ideal output for training.

BasicMLDataSet

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

Parameters:
theData - The data to use.

BasicMLDataSet

public BasicMLDataSet(MLDataSet set)
Copy whatever dataset type is specified into a memory dataset.

Parameters:
set - The dataset to copy.
Method Detail

add

public void add(MLData theData)
Add a object to the dataset. This is used with unsupervised training, as no ideal output is provided. Note: not all implemenations support the add methods.

Specified by:
add in interface MLDataSet
Parameters:
theData - The data item to be added.

add

public void add(MLData inputData,
                MLData idealData)
Add a set of input and ideal data to the dataset. This is used with supervised training, as ideal output is provided. Note: not all implementations support the add methods.

Specified by:
add in interface MLDataSet
Parameters:
inputData - Input data.
idealData - Ideal data.

add

public void add(MLDataPair inputData)
Add a an object to the dataset. This is used with unsupervised training, as no ideal output is provided. Note: not all implementations support the add methods.

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

clone

public Object clone()

Overrides:
clone in class Object

close

public void close()
Close this datasource and release any resources obtained by it, including any iterators created.

Specified by:
close in interface MLDataSet

getData

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

Returns:
the data

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.

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.

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.

setData

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

toList

public static List<MLDataPair> toList(MLDataSet theSet)
Concert the data set to a list.

Parameters:
theSet - The data set to convert.
Returns:
The list.

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.