Question "Predicting Gold Prices"
Doing your code "Predicting Gold Prices"
I wanted to know why trying your example the return are
GRU Prediction: [[4.7930627]]
LSTM Prediction: [[1.1015676]]
I mean isn't supposed to return a prediction of the next value?
Did you run example code in readme?
It is just example.
In practise, we need large data, at least more than 24 previous values.
Each time, every gold price is depending on 24 fore-values.
You might need more data, you can download from financial sites like yahoo.
Which dataset did you use?
I would suggest to use mltrev/gold-price dataset.
You got value around 4 and 0 so it seems that you didn't use this dataset.
import matplotlib.pyplot as plt
# Predict using LSTM
predictions_lstm = lstm_model.predict(X_test)
predictions_lstm = scaler.inverse_transform(predictions_lstm)
# Predict using GRU
predictions_gru = gru_model.predict(X_test)
predictions_gru = scaler.inverse_transform(predictions_gru)
# Plot the results
plt.figure(figsize=(14, 7))
plt.plot(data.index[train_size + seq_length:], data['Adj Close'][train_size + seq_length:], color='blue', label='Actual Gold Price')
plt.plot(data.index[train_size + seq_length:], predictions_lstm, color='red', label='LSTM Predicted Gold Price')
plt.plot(data.index[train_size + seq_length:], predictions_gru, color='green', label='GRU Predicted Gold Price')
plt.title('Gold Price Prediction')
plt.xlabel('Date')
plt.ylabel('Price')
plt.legend()
plt.show()
Which scaling method you applied during training of both models? Kindly elaborate so that we can inverse transform forecasted values accordingly.


