org.encog.ml.data.versatile

## Class MatrixMLDataSet

- java.lang.Object
- - org.encog.ml.data.versatile.MatrixMLDataSet

- All Implemented Interfaces:
    Iterable<MLDataPair>, MLDataSet
  Direct Known Subclasses:
    VersatileMLDataSet

      public class MatrixMLDataSet
      extends Object
      implements MLDataSet

  The MatrixMLDataSet can use a large 2D matrix of doubles to internally hold data. It supports several advanced features such as the ability to mask and time-box. Masking allows several datasets to use the same backing array, however use different parts. Time boxing allows time-series data to be represented for prediction. The following shows how data is laid out for different lag and lead settings. Lag 0; Lead 0 [10 rows] 1->1 2->2 3->3 4->4 5->5 6->6 7->7 8->8 9->9 10->10 Lag 0; Lead 1 [9 rows] 1->2 2->3 3->4 4->5 5->6 6->7 7->8 8->9 9->10 Lag 1; Lead 0 [9 rows, not useful] 1,2->1 2,3->2 3,4->3 4,5->4 5,6->5 6,7->6 7,8->7 8,9->8 9,10->9 Lag 1; Lead 1 [8 rows] 1,2->3 2,3->4 3,4->5 4,5->6 5,6->7 6,7->8 7,8->9 8,9->10 Lag 1; Lead 2 [7 rows] 1,2->3,4 2,3->4,5 3,4->5,6 4,5->6,7 5,6->7,8 6,7->8,9 7,8->9,10 Lag 2; Lead 1 [7 rows] 1,2,3->4 2,3,4->5 3,4,5->6 4,5,6->7 5,6,7->8 6,7,8->9 7,8,9->10

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `MatrixMLDataSet.MatrixMLDataSetIterator` An iterator to be used with the MatrixMLDataSet.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MatrixMLDataSet()` The default constructor.
    `MatrixMLDataSet(double[][] theData, int theCalculatedInputSize, int theCalculatedIdealSize)` Construct the dataset with no mask.
    `MatrixMLDataSet(double[][] theData, int inputCount, int idealCount, int[] theMask)` Construct the dataset from a 2D double array..
    `MatrixMLDataSet(MatrixMLDataSet data, int[] mask)` Construct the dataset from another matrix dataset.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(MLData data1)` 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.
    `void` | `close()` Close this datasource and release any resources obtained by it, including any iterators created.
    `MLDataPair` | `get(int index)`
    `int` | `getCalculatedIdealSize()`
    `int` | `getCalculatedInputSize()`
    `double[][]` | `getData()`
    `int` | `getIdealSize()`
    `int` | `getInputSize()`
    `int` | `getLagWindowSize()`
    `int` | `getLeadWindowSize()`
    `int[]` | `getMask()`
    `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` | `setCalculatedIdealSize(int calculatedIdealSize)`
    `void` | `setCalculatedInputSize(int calculatedInputSize)`
    `void` | `setData(double[][] data)`
    `void` | `setLagWindowSize(int lagWindowSize)`
    `void` | `setLeadWindowSize(int leadWindowSize)`
    `int` | `size()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MatrixMLDataSet

          public MatrixMLDataSet()

      The default constructor.

    - #### MatrixMLDataSet

          public MatrixMLDataSet(double[][] theData,
                         int theCalculatedInputSize,
                         int theCalculatedIdealSize)

      Construct the dataset with no mask.
      Parameters:
        `theData` - The backing array.
        `theCalculatedInputSize` - The input size.
        `theCalculatedIdealSize` - The ideal size.

    - #### MatrixMLDataSet

          public MatrixMLDataSet(double[][] theData,
                         int inputCount,
                         int idealCount,
                         int[] theMask)

      Construct the dataset from a 2D double array..
      Parameters:
        `theData` - The data.
        `inputCount` - The input count.
        `idealCount` - The ideal count.
        `theMask` - The mask.

    - #### MatrixMLDataSet

          public MatrixMLDataSet(MatrixMLDataSet data,
                         int[] mask)

      Construct the dataset from another matrix dataset.
      Parameters:
        `theData` - The data.
        `inputCount` - The input count.
        `idealCount` - The ideal count.
        `theMask` - The mask.

  - ### Method Detail

    - #### getMask

          public int[] getMask()

      Returns:
        The mask.

    - #### iterator

          public Iterator<MLDataPair> iterator()

      Specified by:
        `iterator` in interface `Iterable<MLDataPair>`

    - #### 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.

    - #### isSupervised

          public boolean isSupervised()

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

    - #### 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.

    - #### 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.

    - #### openAdditional

          public MLDataSet openAdditional()

      Opens an additional instance of this dataset.
      Specified by:
        `openAdditional` in interface `MLDataSet`
      Returns:
        The new instance.

    - #### add

          public void add(MLData data1)

      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:
        `data1` - 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.

    - #### close

          public void close()

      Close this datasource and release any resources obtained by it, including any iterators created.
      Specified by:
        `close` in interface `MLDataSet`

    - #### size

          public int size()

      Specified by:
        `size` in interface `MLDataSet`

    - #### get

          public MLDataPair get(int index)

      Specified by:
        `get` in interface `MLDataSet`

    - #### getCalculatedInputSize

          public int getCalculatedInputSize()

      Returns:
        the calculatedInputSize

    - #### setCalculatedInputSize

          public void setCalculatedInputSize(int calculatedInputSize)

      Parameters:
        `calculatedInputSize` - the calculatedInputSize to set

    - #### getCalculatedIdealSize

          public int getCalculatedIdealSize()

      Returns:
        the calculatedIdealSize

    - #### setCalculatedIdealSize

          public void setCalculatedIdealSize(int calculatedIdealSize)

      Parameters:
        `calculatedIdealSize` - the calculatedIdealSize to set

    - #### getData

          public double[][] getData()

      Returns:
        the data

    - #### setData

          public void setData(double[][] data)

      Parameters:
        `data` - the data to set

    - #### getLagWindowSize

          public int getLagWindowSize()

      Returns:
        the lagWindowSize

    - #### setLagWindowSize

          public void setLagWindowSize(int lagWindowSize)

      Parameters:
        `lagWindowSize` - the lagWindowSize to set

    - #### getLeadWindowSize

          public int getLeadWindowSize()

      Returns:
        the leadWindowSize

    - #### setLeadWindowSize

          public void setLeadWindowSize(int leadWindowSize)

      Parameters:
        `leadWindowSize` - the leadWindowSize to set

Copyright © 2014. All Rights Reserved.