Class TimeSeriesDataset

    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeSeriesDataset​(org.api4.java.ai.ml.core.dataset.schema.ILabeledInstanceSchema schema)  
      TimeSeriesDataset​(org.api4.java.ai.ml.core.dataset.schema.ILabeledInstanceSchema schema, java.util.List<org.nd4j.linalg.api.ndarray.INDArray> valueMatrices, java.util.List<org.nd4j.linalg.api.ndarray.INDArray> timestampMatrices, java.util.List<java.lang.Object> targets)
      Creates a TimeSeries dataset.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String attributeName, org.nd4j.linalg.api.ndarray.INDArray valueMatrix, org.nd4j.linalg.api.ndarray.INDArray timestampMatrix)
      Add a time series variable to the dataset.
      TimeSeriesDataset createCopy()  
      TimeSeriesDataset createEmptyCopy()  
      boolean equals​(java.lang.Object obj)  
      TimeSeriesInstance get​(int index)  
      java.lang.Object[][] getFeatureMatrix()  
      java.lang.Object[] getLabelVector()  
      long getNumberOfInstances()  
      int getNumberOfVariables()  
      java.lang.Object getTargets()  
      org.nd4j.linalg.api.ndarray.INDArray getTargetsAsINDArray()  
      org.nd4j.linalg.api.ndarray.INDArray getTimestamps​(int index)  
      org.nd4j.linalg.api.ndarray.INDArray getTimestampsOrNull​(int index)  
      org.nd4j.linalg.api.ndarray.INDArray getValues​(int index)  
      org.nd4j.linalg.api.ndarray.INDArray getValuesOrNull​(int index)  
      int hashCode()  
      boolean isEmpty()  
      boolean isMultivariate()  
      boolean isUnivariate()  
      java.util.Iterator<ITimeSeriesInstance> iterator()  
      void removeColumn​(int index)
      Removes the time series variable at a given index.
      void replace​(int index, org.nd4j.linalg.api.ndarray.INDArray valueMatrix, org.nd4j.linalg.api.ndarray.INDArray timestampMatrix)
      Replaces the time series variable at a given index with a new one.
      • Methods inherited from class java.util.ArrayList

        add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface org.api4.java.ai.ml.core.dataset.IDataset

        getClassOfInstances, removeColumn, removeColumn
      • Methods inherited from interface org.api4.java.ai.ml.core.dataset.schema.IInstanceSchemaHandler

        getAttribute, getListOfAttributes, getNumAttributes
      • Methods inherited from interface org.api4.java.ai.ml.core.dataset.schema.ILabeledInstanceSchemaHandler

        getInstanceSchema, getLabelAttribute, getRelationName
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
    • Constructor Detail

      • TimeSeriesDataset

        public TimeSeriesDataset​(org.api4.java.ai.ml.core.dataset.schema.ILabeledInstanceSchema schema,
                                 java.util.List<org.nd4j.linalg.api.ndarray.INDArray> valueMatrices,
                                 java.util.List<org.nd4j.linalg.api.ndarray.INDArray> timestampMatrices,
                                 java.util.List<java.lang.Object> targets)
        Creates a TimeSeries dataset. Let `n` be the number of instances.
        Parameters:
        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.
      • TimeSeriesDataset

        public TimeSeriesDataset​(org.api4.java.ai.ml.core.dataset.schema.ILabeledInstanceSchema schema)
    • Method Detail

      • add

        public void add​(java.lang.String attributeName,
                        org.nd4j.linalg.api.ndarray.INDArray valueMatrix,
                        org.nd4j.linalg.api.ndarray.INDArray timestampMatrix)
        Add a time series variable to the dataset.
        Parameters:
        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.
      • removeColumn

        public void removeColumn​(int index)
        Removes the time series variable at a given index.
        Specified by:
        removeColumn in interface org.api4.java.ai.ml.core.dataset.IDataset<ITimeSeriesInstance>
        Parameters:
        index -
        Throws:
        java.lang.IndexOutOfBoundsException
      • replace

        public void replace​(int index,
                            org.nd4j.linalg.api.ndarray.INDArray valueMatrix,
                            org.nd4j.linalg.api.ndarray.INDArray timestampMatrix)
        Replaces the time series variable at a given index with a new one.
        Parameters:
        index - Index of the time series variable 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.
        Throws:
        java.lang.IndexOutOfBoundsException - Thrown if `numberOfInstances <= index`.
      • getTargets

        public java.lang.Object getTargets()
      • getTargetsAsINDArray

        public org.nd4j.linalg.api.ndarray.INDArray getTargetsAsINDArray()
      • getNumberOfVariables

        public int getNumberOfVariables()
      • getNumberOfInstances

        public long getNumberOfInstances()
      • getValues

        public org.nd4j.linalg.api.ndarray.INDArray getValues​(int index)
      • getTimestamps

        public org.nd4j.linalg.api.ndarray.INDArray getTimestamps​(int index)
      • getValuesOrNull

        public org.nd4j.linalg.api.ndarray.INDArray getValuesOrNull​(int index)
      • getTimestampsOrNull

        public org.nd4j.linalg.api.ndarray.INDArray getTimestampsOrNull​(int index)
      • isUnivariate

        public boolean isUnivariate()
      • isMultivariate

        public boolean isMultivariate()
      • createEmptyCopy

        public TimeSeriesDataset createEmptyCopy()
                                          throws org.api4.java.ai.ml.core.exception.DatasetCreationException,
                                                 java.lang.InterruptedException
        Specified by:
        createEmptyCopy in interface org.api4.java.ai.ml.core.dataset.IDataset<ITimeSeriesInstance>
        Specified by:
        createEmptyCopy in interface org.api4.java.ai.ml.core.dataset.IDataSource<ITimeSeriesInstance>
        Specified by:
        createEmptyCopy in interface org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<ITimeSeriesInstance>
        Throws:
        org.api4.java.ai.ml.core.exception.DatasetCreationException
        java.lang.InterruptedException
      • createCopy

        public TimeSeriesDataset createCopy()
                                     throws org.api4.java.ai.ml.core.exception.DatasetCreationException,
                                            java.lang.InterruptedException
        Specified by:
        createCopy in interface org.api4.java.ai.ml.core.dataset.IDataset<ITimeSeriesInstance>
        Specified by:
        createCopy in interface org.api4.java.ai.ml.core.dataset.IDataSource<ITimeSeriesInstance>
        Throws:
        org.api4.java.ai.ml.core.exception.DatasetCreationException
        java.lang.InterruptedException