org.encog.ml.data.versatile
Class MatrixMLDataSet
- java.lang.Object
-
- org.encog.ml.data.versatile.MatrixMLDataSet
-
- All Implemented Interfaces:
- java.lang.Iterable<MLDataPair>, MLDataSet
- Direct Known Subclasses:
- VersatileMLDataSet
public class MatrixMLDataSet extends java.lang.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 classMatrixMLDataSet.MatrixMLDataSetIteratorAn 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(MLData data1)Add a object to the dataset.voidadd(MLData inputData, MLData idealData)Add a set of input and ideal data to the dataset.voidadd(MLDataPair inputData)Add a an object to the dataset.voidclose()Close this datasource and release any resources obtained by it, including any iterators created.MLDataPairget(int index)intgetCalculatedIdealSize()intgetCalculatedInputSize()double[][]getData()intgetIdealSize()intgetInputSize()intgetLagWindowSize()intgetLeadWindowSize()int[]getMask()voidgetRecord(long index, MLDataPair pair)Read an individual record, specified by index, in random order.longgetRecordCount()Determine the total number of records in the set.booleanisSupervised()java.util.Iterator<MLDataPair>iterator()MLDataSetopenAdditional()Opens an additional instance of this dataset.voidsetCalculatedIdealSize(int calculatedIdealSize)voidsetCalculatedInputSize(int calculatedInputSize)voidsetData(double[][] data)voidsetLagWindowSize(int lagWindowSize)voidsetLeadWindowSize(int leadWindowSize)intsize()
-
-
-
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:
data- The data.mask- The mask.
-
-
Method Detail
-
getMask
public int[] getMask()
- Returns:
- The mask.
-
iterator
public java.util.Iterator<MLDataPair> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<MLDataPair>
-
getIdealSize
public int getIdealSize()
- Specified by:
getIdealSizein interfaceMLDataSet- Returns:
- The size of the ideal data.
-
getInputSize
public int getInputSize()
- Specified by:
getInputSizein interfaceMLDataSet- Returns:
- The size of the input data.
-
isSupervised
public boolean isSupervised()
- Specified by:
isSupervisedin interfaceMLDataSet- Returns:
- True if this is a supervised training set.
-
getRecordCount
public long getRecordCount()
Determine the total number of records in the set.- Specified by:
getRecordCountin interfaceMLDataSet- 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.
-
openAdditional
public MLDataSet openAdditional()
Opens an additional instance of this dataset.- Specified by:
openAdditionalin interfaceMLDataSet- 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.
-
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.
-
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.
-
close
public void close()
Close this datasource and release any resources obtained by it, including any iterators created.
-
get
public MLDataPair get(int index)
-
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
-
-
DMelt 3.0 © DataMelt by jWork.ORG