For Seq2Seq deep learning architectures, viz., LSTM/GRU and multivariate, multistep time series forecasting, it is important to convert the data to a 3D dimension: (batch_size, look_back, number_features). Here look_back decides the number of past data points/samples to consider using number_features from your training dataset. Similarly, look_ahead needs to be defined which defines the number of steps in the future, you want your model to forecast for.

I have a written a function to help achieve this:

def split_series_multivariate(data, n_past, n_future):
    Create training and testing splits required by Seq2Seq
    architecture(s) for multivariate, multistep and multivariate
    output time-series modeling.
    X, y = list(), list()
    for window_start in range(len(data)):
        past_end = window_start + n_past
        future_end = past_end + n_future
        if future_end > len(data):
        # slice past and future parts of window-
        past, future = data[window_start: past_end, :], data[past_end: future_end, :]
        # past, future = data[window_start: past_end, :], data[past_end: future_end, 4]
    return np.array(X), np.array(y)

But, look_back and look_ahead are hyper-parameters that need to be tuned for a given dataset.

# Define hyper-parameters for Seq2Seq modeling:

# look-back window size-
n_past = 30

# number of future steps to predict for-
n_future = 10

# number of features used-
n_features = 8

What is the best practice for choosing/finding look_back and look_ahead hyper-parameters?



You must log in to answer this question.

Browse other questions tagged .