I’m attempting to predict traffic using an LSTM model, but the outcome of my predictions are negative values. Is this normal, or could it indicate an error? Following are my code:

train_predict = model.predict(X_train)

test_predict = model.predict(X_test)train_predict = scaler.inverse_transform(train_predict)

Y_train = scaler.inverse_transform([Y_train])

test_predict = scaler.inverse_transform(test_predict)

Y_test = scaler.inverse_transform([Y_test])train_score = np.sqrt(mean_squared_error(Y_train[0], train_predict[:,0]))

print(‘Train RMSE:’, train_score)

test_score = np.sqrt(mean_squared_error(Y_test[0], test_predict[:,0]))

print(‘Test RMSE:’, test_score)future_time_steps = 5

future_predictions = []

last_sequence = X_test[-1]

for _ in range(future_time_steps):

prediction = model.predict(last_sequence.reshape(1, time_steps, 1))

future_predictions.append(prediction[0][0])

last_sequence = np.roll(last_sequence, -1)

last_sequence[-1] = prediction[0][0]

future_predictions = scaler.inverse_transform(np.array(future_predictions).reshape(-1,1))

print(‘Future Predictions:’, future_predictions)

and the result is:

1/1 [==============================] - 0s 24ms/step

1/1 [==============================] - 0s 19ms/step

1/1 [==============================] - 0s 19ms/step

1/1 [==============================] - 0s 18ms/step

1/1 [==============================] - 0s 18ms/step

Future Predictions: [[-1.0864409 ]

[-1.0021602 ]

[-0.9143658 ]

[-0.81085765]

[-0.69729006]]