public class TimeSeriesDataset
extends java.lang.Object
The dataset consists of a value matrices and timestamp matrices. In the
univariate case, there exists one value matrix, either with or without a
corresponding timestamp matrix. In the multivariate case there exists
multiple value matrices, each either with or without a corresponding
timestamp matrix. Each value matrix is associated with an integer index. Each
timestamp matrix is associated with an integer index. Two corresponding value
and timestamp matrices are associated with the same index. The dimensions of
two corresponding value and timestamp matrices are assured to be the same.
All value matrices have the same number of rows, but not necessarily the same
number of columns. The i-th row of each matrix corresponds to
the i-th instance of the dataset.
The targets contained in this dataset are always integers. The can be mapped
back and forth with the ClassMapper. Targets are represented as an
integer array. The i-th entry of this array corresponds to the
i-th instance of the dataset.
| Constructor and Description |
|---|
TimeSeriesDataset(java.util.List<double[][]> valueMatrices)
Creates a time series dataset without timestamps for testing.
|
TimeSeriesDataset(java.util.List<double[][]> valueMatrices,
int[] targets)
Creates a time series dataset withot timestamps for training.
|
TimeSeriesDataset(java.util.List<double[][]> valueMatrices,
java.util.List<double[][]> timestampMatrices)
Creates a time series dataset with timestamps for testing.
|
TimeSeriesDataset(java.util.List<double[][]> valueMatrices,
java.util.List<double[][]> timestampMatrices,
int[] targets)
Creates a time series dataset with timestamps for training.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double[][] valueMatrix)
Add a time series variable without timestamps to the dataset.
|
void |
add(double[][] valueMatrix,
double[][] timestampMatrix)
Add a time series variable with timestamps to the dataset.
|
int |
getNumberOfInstances()
Returns the number of instances contained in the dataset.
|
int |
getNumberOfVariables()
Returns the number of variables, i.e. the number of value matrices contained
in the dataset.
|
int[] |
getTargets()
Getter for the target values.
|
java.util.List<double[][]> |
getTimestampMatrices()
Getter for
timestampMatrices. |
double[][] |
getTimestamps(int index)
Getter for the timestamp matrix at a specific index.
|
double[][] |
getTimestampsOrNull(int index)
Getter for the timestamp matrix at a specific index.
|
java.util.List<double[][]> |
getValueMatrices()
Getter for
valueMatrices. |
double[][] |
getValues(int index)
Getter for the value matrix at a specific index.
|
double[][] |
getValuesOrNull(int index)
Getter for the value matrix at a specific index.
|
boolean |
isEmpty()
States whether the dataset is empty, i.e. contains no value matrices, or not.
|
boolean |
isMultivariate()
States whether the dataset is a univariate dataset, i.e. contains more than
one value matrix, or not.
|
boolean |
isTest()
States whether the dataset is a test dataset, i.e. contains no valid targets
after initialization, or not.
|
boolean |
isTrain()
States whether the dataset is a training dataset, i.e. contains valid targets
after initialization, or not.
|
boolean |
isUnivariate()
States whether the dataset is a univariate dataset, i.e. contains exactly one
value matrix, or not.
|
void |
remove(int index)
Removes the time series variable at a given index.
|
void |
replace(int index,
double[][] valueMatrix,
double[][] timestampMatrix)
Replaces the time series variable at a given index with a new one.
|
void |
setTargets(int[] targets)
Setter for
targets. |
void |
setTimestampMatrices(java.util.List<double[][]> timestampMatrices)
Setter for
timestampMatrices. |
void |
setValueMatrices(java.util.List<double[][]> valueMatrices)
Setter for
valueMatrices. |
public TimeSeriesDataset(java.util.List<double[][]> valueMatrices,
java.util.List<double[][]> timestampMatrices,
int[] targets)
valueMatrices - Values for the time series variables. List of
2D-Arrays with shape `[n, ?]`.timestampMatrices - Timestamps for the time series variables. List of
2D-Arrays with shape `[n, ?]`. Or `null` if no
timestamps exist for the corresponding time series
variable. The shape of the `i`th index must be equal
to the shape of the `i`th element of
`valueMatrices`.targets - Target values for the instances.public TimeSeriesDataset(java.util.List<double[][]> valueMatrices,
java.util.List<double[][]> timestampMatrices)
valueMatrices - Values for the time series variables. List of
2D-Arrays with shape `[n, ?]`.timestampMatrices - Timestamps for the time series variables. List of
2D-Arrays with shape `[n, ?]`. Or `null` if no
timestamps exist for the corresponding time series
variable. The shape of the `i`th index must be equal
to the shape of the `i`th element of
`valueMatrices`.targets - Target values for the instances.public TimeSeriesDataset(java.util.List<double[][]> valueMatrices,
int[] targets)
valueMatrices - Values for the time series variables. List of
2D-Arrays with shape `[n, ?]`.timestampMatrices - Timestamps for the time series variables. List of
2D-Arrays with shape `[n, ?]`. Or `null` if no
timestamps exist for the corresponding time series
variable. The shape of the `i`th index must be equal
to the shape of the `i`th element of
`valueMatrices`.targets - Target values for the instances.public TimeSeriesDataset(java.util.List<double[][]> valueMatrices)
valueMatrices - Values for the time series variables. List of 2D-Arrays
with shape `[n, ?]`.targets - Target values for the instances.public void add(double[][] valueMatrix,
double[][] timestampMatrix)
valueMatrix - Values for the time series variable to add. 2D-Arrays
with shape `[n, ?]` where `n` is the number of
instances of the dataset.timestampMatrix - Timestamps for the time series variable to add.
2D-Arrays with shape `[n, ?]` where `n` is the number
of instances of the dataset. Or `null` if no timestamp
exists for this time series variable.public void add(double[][] valueMatrix)
valueMatrix - Values for the time series variable to add. 2D-Arrays with
shape `[n, ?]` where `n` is the number of instances of the
dataset.public void remove(int index)
index - java.lang.IndexOutOfBoundsExceptionpublic void replace(int index,
double[][] valueMatrix,
double[][] timestampMatrix)
index - Index of the time series varialbe to replace.valueMatrix - Values for the time series variable to add. 2D-Arrays
with shape `[n, ?]` where `n` is the number of
instances of the dataset.timestampMatrix - Timestamps for the time series variable to add.
2D-Arrays with shape `[n, ?]` where `n` is the number
of instances of the dataset. Or `null` if no timestamp
exists for this time series variable.java.lang.IndexOutOfBoundsException - Thrown if `numberOfInstances <= index`.public int[] getTargets()
public int getNumberOfVariables()
public int getNumberOfInstances()
public double[][] getValues(int index)
index - The index of the value matrix.index.java.lang.IndexOutOfBoundsException - If there is no value matrix at index
index.public double[][] getTimestamps(int index)
index - The index of the timestamp matrix.index.java.lang.IndexOutOfBoundsException - If there is no value timestamp at index
index.public double[][] getValuesOrNull(int index)
index - The index of the timestamp matrix.index. Or null,
if no value matrix exists at index index.public double[][] getTimestampsOrNull(int index)
index - The index of the timestamp matrix.index. Or
null, if no timestamp matrix exists at index
index.public boolean isEmpty()
True, if the dataset is empty. False,
otherwise.public boolean isUnivariate()
True, if the dataset is univariate. False,
otherwise.public boolean isMultivariate()
True, if the dataset is multivariate.
False, otherwise.public boolean isTrain()
True, if the dataset is a training dataset.
False, otherwise.public boolean isTest()
True, if the dataset is a test dataset.
False, otherwise.public java.util.List<double[][]> getValueMatrices()
valueMatrices.public java.util.List<double[][]> getTimestampMatrices()
timestampMatrices.public void setValueMatrices(java.util.List<double[][]> valueMatrices)
valueMatrices.valueMatrices - the valueMatrices to setpublic void setTimestampMatrices(java.util.List<double[][]> timestampMatrices)
timestampMatrices.timestampMatrices - the timestampMatrices to setpublic void setTargets(int[] targets)
targets.targets - the targets to set