Hello, I’m using household_power_dataset(uploaded it to google drive). I take 7 columns from this dataset and split data by 24, so my window_size is 24. I get the first 24 entries and try to predict the next one. The question is how can I make my model predict 24 steps ahead instead of one? I’ve been trying to find information for a couple of days and still have no luck. So my main goal is to make the model to output the result in shape of (24, 7). If you have any idea how can I get this shape please let me know because I’m stuck. Here is the code of my model
import pandas as pd import tensorflow as tf import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, LSTM, Dropout, Flatten, Activation, BatchNormalization def normalize_series(data, min, max): data = data - min data = data / max return data df = pd.read_csv('household_power_consumption.csv', sep=',', infer_datetime_format=True, index_col='datetime', header=0) # Normalizes the data data = df.values data = normalize_series(data, data.min(axis=0), data.max(axis=0)) SPLIT_TIME = int(len(data) * 0.5) x_train = data[:SPLIT_TIME] x_valid = data[SPLIT_TIME:] # It's pretty rough because it only for testing purposes # Train data X = [] Y = [] window_size = 24 for i in range(len(x_train) - window_size + 1): if len(x_train) - 1 >= i + window_size: X.append(x_train[i: i + window_size]) Y.append(x_train[i + window_size]) X = np.array(X) Y = np.array(Y) # Validation data X_test = [] Y_test = [] window_size = 24 for i in range(len(x_valid) - window_size + 1): if len(x_valid) - 1 >= i + window_size: X_test.append(x_valid[i: i + window_size]) Y_test.append(x_valid[i + window_size]) X_test = np.array(X_test) Y_test = np.array(Y_test) model = Sequential() model.add(LSTM(128, input_shape=(24, 7))) model.add(Dense(100, activation='relu')) model.add(Dense(7)) model.compile(loss='mae', optimizer='adam') # fit network model.fit(X,Y, batch_size=32, validation_data=(X_test, Y_test), epochs=30)