Orion
path: mlstars.custom.timeseries_preprocessing.rolling_window_sequences
mlstars.custom.timeseries_preprocessing.rolling_window_sequences
description: this primitive generates many sub-sequences of the original sequence. it uses a rolling window approach to create the sub-sequences out of time series data.
see json.
argument
type
description
parameters
X
numpy.ndarray
n-dimensional sequence to iterate over
index
array containing the index values of X
drop
numpy.ndarray, str, float, bool, or None
str
float
bool
None
array of boolean values indicating which value should be dropped
hyperparameters
window_size
int
length of the input sequences
target_size
length of the target sequences
step_size
indicating the number of steps to move the window forward each round
target_column
indicating which column of X is the target
drop_windows
indicates whether the dropping functionality should be enabled
output
input sequences
y
target sequences
first index value of each input sequence
target_index
first index value of each target sequence
In [1]: import numpy as np In [2]: from mlstars import load_primitive In [3]: primitive = load_primitive('mlstars.custom.timeseries_preprocessing.rolling_window_sequences', ...: arguments={"window_size": 10, "target_size": 1, "step_size": 1, "target_column": 0}) ...: In [4]: X = np.array([1] * 50).reshape(-1, 1) In [5]: index = np.array(range(50)).reshape(-1, 1) In [6]: X, y, index, target_index = primitive.produce(X=X, index=index) In [7]: print("X shape = {}\ny shape = {}\nindex shape = {}\ntarget index shape = {}".format( ...: X.shape, y.shape, index.shape, target_index.shape)) ...: X shape = (40, 10, 1) y shape = (40, 1) index shape = (40, 1) target index shape = (40, 1)