org.encog.neural.data.csv
Class CSVNeuralDataSet

java.lang.Object
  extended by org.encog.neural.data.csv.CSVNeuralDataSet
All Implemented Interfaces:
Iterable<NeuralDataPair>, EngineDataSet, NeuralDataSet

public class CSVNeuralDataSet
extends Object
implements NeuralDataSet

An implementation of the NeuralDataSet interface designed to provide a CSV file to the neural network. This implementation uses the BasicNeuralData to hold the data being read. This class has no ability to write CSV files. The columns of the CSV file will specify both the input and ideal columns. This class is not memory based, so very long files can be used, without running out of memory. This class can be slow, as it can take awhile to parse all of the numbers in a really long CSV file. Because of this it is best not to use this set directly with a training algorithm. Rather use it to load a BufferedNeuralDataSet.

Author:
jheaton

Nested Class Summary
 class CSVNeuralDataSet.CSVNeuralIterator
          An iterator designed to read from CSV files.
 
Field Summary
static String ADD_NOT_SUPPORTED
          Error message indicating that adds are not supported.
 
Constructor Summary
CSVNeuralDataSet(String filename, int inputSize, int idealSize, boolean headers)
          Construct this data set using a comma as a delimiter.
CSVNeuralDataSet(String filename, int inputSize, int idealSize, boolean headers, CSVFormat format)
          Construct this data set using a comma as a delimiter.
 
Method Summary
 void add(NeuralData data1)
          Adds are not supported.
 void add(NeuralData inputData, NeuralData idealData)
          Adds are not supported.
 void add(NeuralDataPair inputData)
          Adds are not supported.
 void close()
          Close any iterators from this dataset.
 String getFilename()
           
 CSVFormat getFormat()
           
 int getIdealSize()
           
 int getInputSize()
           
 boolean isSupervised()
           
 Iterator<NeuralDataPair> iterator()
          Get an iterator to use with the CSV data.
 
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 indicating that adds are not supported.

See Also:
Constant Field Values
Constructor Detail

CSVNeuralDataSet

public CSVNeuralDataSet(String filename,
                        int inputSize,
                        int idealSize,
                        boolean headers)
Construct this data set using a comma as a delimiter.

Parameters:
filename - The CSV filename to read.
inputSize - The number of columns that make up the input set. *
idealSize - The number of columns that make up the ideal set.
headers - True if headers are present on the first line.

CSVNeuralDataSet

public CSVNeuralDataSet(String filename,
                        int inputSize,
                        int idealSize,
                        boolean headers,
                        CSVFormat format)
Construct this data set using a comma as a delimiter.

Parameters:
filename - The CSV filename to read.
inputSize - The number of columns that make up the input set. *
idealSize - The number of columns that make up the ideal set.
headers - True if headers are present on the first line.
format - What CSV format to use.
Method Detail

add

public void add(NeuralData data1)
Adds are not supported.

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

add

public void add(NeuralData inputData,
                NeuralData idealData)
Adds are not supported.

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

add

public void add(NeuralDataPair inputData)
Adds are not supported.

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

close

public void close()
Close any iterators from this dataset.

Specified by:
close in interface NeuralDataSet

getFilename

public String getFilename()
Returns:
the filename

getFormat

public CSVFormat getFormat()
Returns:
the delimiter

getIdealSize

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

getInputSize

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

iterator

public Iterator<NeuralDataPair> iterator()
Get an iterator to use with the CSV data.

Specified by:
iterator in interface Iterable<NeuralDataPair>
Returns:
An iterator.

isSupervised

public boolean isSupervised()
Specified by:
isSupervised in interface EngineDataSet
Specified by:
isSupervised in interface NeuralDataSet
Returns:
True if this training data is supervised.


Copyright © 2011. All Rights Reserved.