df = pd.read_csv('Weekly_U.S.Diesel_Retail_Prices.csv',
infer_datetime_format=True, index_col='Week of', header=0)
N_FEATURES = len(df.columns)
data = df.values
data = normalize_series(data, data.min(axis=0), data.max(axis=0))
SPLIT_TIME = int(len(data) * 0.8)
x_train = data[:SPLIT_TIME]
x_valid = data[SPLIT_TIME:]
tf.keras.backend.clear_session()
tf.random.set_seed(42)
BATCH_SIZE = 32
N_PAST = 10
N_FUTURE = 10
SHIFT = 1
train_set = windowed_dataset(series=x_train, batch_size=BATCH_SIZE,
n_past=N_PAST, n_future=N_FUTURE,
shift=SHIFT)
valid_set = windowed_dataset(series=x_valid, batch_size=BATCH_SIZE,
n_past=N_PAST, n_future=N_FUTURE,
shift=SHIFT)
model = tf.keras.models.Sequential([
tf.keras.layers.InputLayer(input_shape=(N_PAST, N_FEATURES),name='Input'),
tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(N_FEATURES, input_shape=(BATCH_SIZE,N_PAST, N_FEATURES),activation='relu', return_sequences=True)),
tf.keras.layers.Dense(N_FEATURES)
])
model.compile(
loss='mae',
optimizer=tf.keras.optimizers.Adam(),
metrics=['mae']
)
model.fit(
train_set,
epochs = 50,
)
Welcome to the Tensorflow Forum!
For some reason, my model is not satisfying the test cases
Can you please elaborate on the above statement?
I am having the same problem.