TransWikia.com

How to choose the correct data's shape for time series with Keras

Data Science Asked on April 30, 2021

I would like to create an LSTM using Keas, which takes as input a multivariate time series.

Following that example, we can see how the label hasbeen shaped:

y_train = features.iloc[start:end][[1]]
  • First question: why this data format?

I have tried with: y_train = train_data.iloc[:, -1]

Later, I have passed that label to timeseries_dataset_from_array():

dataset_train = keras.preprocessing.timeseries_dataset_from_array(
    x_train,
    y_train,
    sequence_length=sequence_length,
    batch_size=batch_size,
)

Which returns a wrong target’s shape (64, ), where the correct shape should be (64, 1)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP