matrix2Tensor3D: matrix2Tensor3D

Description Usage Arguments Value Examples

View source: R/embeddingFunctions.R

Description

Auxiliary function to embed a 2D matrix into a 3D tensor.

Usage

1
matrix2Tensor3D(X, time_window, shift = 1, padNA = FALSE)

Arguments

X
  • Input matrix

time_window
  • Integer specifying the size of the time window (aka model order, 2nd dimension in tensor).

shift
  • Integer specifying how far the sliding window should be shifted in order to create the tensor (N.B. shift < time_window implies overlapping data)

padNA
  • Boolean specifying whether NAs should be used to pad tensors in case the input matrix size is not multiple of the time_window.

Value

3D Tensor (Samples,Time Window,Features) containing the embedded form of X (the second dimension is fixed to time_window)

Examples

1
2
3
X <- EuStockMarkets
time_window <- 5
X_windowed <- matrix2Tensor3D(X,time_window,time_window)

jdestefani/ExtendedDFML documentation built on Dec. 20, 2021, 10:04 p.m.