Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.ml.data.buffer.codec
Class CSVDataCODEC

    java.lang.Object
      org.encog.ml.data.buffer.codec.CSVDataCODEC

All Implemented Interfaces:
  DataSetCODEC

    public class CSVDataCODEC

extends Object
implements DataSetCODEC

A CODEC used to read/write data from/to a CSV data file. There are two constructors provided, one is for reading, the other for writing. Make sure you use the correct one for your intended purpose. This CODEC is typically used with the BinaryDataLoader, to load external data into the Encog binary training format.

Constructor Summary
`CSVDataCODEC(File theFile, CSVFormat theFormat, boolean theExpectSignificance)` Constructor to create CSV from binary..
`CSVDataCODEC(File theFile, CSVFormat theFormat, boolean theHeaders, int theInputCount, int theIdealCount, boolean theExpectSignificance)` Create a CODEC to load data from CSV to binary.

Method Summary
`void` | `close()` Close any open files.
`int` | `getIdealSize()`
`int` | `getInputSize()`
`void` | `prepareRead()` Prepare to read from the CSV file.
`void` | `prepareWrite(int recordCount, int inputSize, int idealSize)` Prepare to write to a CSV file.
`boolean` | `read(double[] input, double[] ideal, double[] significance)` Read one record of data from a CSV file.
`void` | `write(double[] input, double[] ideal, double significance)` Write one record of data to a CSV file.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CSVDataCODEC

    public CSVDataCODEC(File theFile,
                        CSVFormat theFormat,
                        boolean theExpectSignificance)

  Constructor to create CSV from binary..

  Parameters:
    `theFile` - The CSV file to create.
    `theFormat` - The format for that CSV file.
    `theExpectSignificance` - True, if a significance column is expected.

### CSVDataCODEC

    public CSVDataCODEC(File theFile,
                        CSVFormat theFormat,
                        boolean theHeaders,
                        int theInputCount,
                        int theIdealCount,
                        boolean theExpectSignificance)

  Create a CODEC to load data from CSV to binary.

  Parameters:
    `theFile` - The CSV file to load.
    `theFormat` - The format that the CSV file is in.
    `theHeaders` - True, if there are headers.
    `theInputCount` - The number of input columns.
    `theIdealCount` - The number of ideal columns.
    `theExpectSignificance` - True, if a significance column is expected.

Method Detail

### close

    public final void close()

  Close any open files.

  Specified by:
    `close` in interface `DataSetCODEC`

### getIdealSize

    public final int getIdealSize()

  Specified by:
    `getIdealSize` in interface `DataSetCODEC`
  Returns:
    The size of the ideal data.

### getInputSize

    public final int getInputSize()

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

### prepareRead

    public final void prepareRead()

  Prepare to read from the CSV file.

  Specified by:
    `prepareRead` in interface `DataSetCODEC`

### prepareWrite

    public final void prepareWrite(int recordCount,
                                   int inputSize,
                                   int idealSize)

  Prepare to write to a CSV file.

  Specified by:
    `prepareWrite` in interface `DataSetCODEC`
  Parameters:
    `recordCount` - The total record count, that will be written.
    `inputSize` - The input size.
    `idealSize` - The ideal size.

### read

    public final boolean read(double[] input,
                              double[] ideal,
                              double[] significance)

  Read one record of data from a CSV file.

  Specified by:
    `read` in interface `DataSetCODEC`
  Parameters:
    `input` - The input data array.
    `ideal` - The ideal data array.
  Returns:
    True, if there is more data to be read.

### write

    public final void write(double[] input,
                            double[] ideal,
                            double significance)

  Write one record of data to a CSV file.

  Specified by:
    `write` in interface `DataSetCODEC`
  Parameters:
    `input` - The input data array.
    `ideal` - The ideal data array.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.