-
-
Save riqbal-k/04573c97e80e12a69f814e4376fd0423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculate the predicted returns using the LSTM model | |
y_train_pred_returns <- model %>% predict(x_train) | |
y_test_pred_returns <- model %>% predict(x_test) | |
# Set up the layout of the plots | |
par(mfrow = c(1,2)) | |
options(repr.plot.width=15, repr.plot.height=8) | |
# Plot the training and predicted values | |
plot(y_train, type = "l", col = "green",main="Apple daily Log Returns", xlab = "Day", ylab = "Returns",lwd =3) | |
lines(y_train_pred_returns, col = "red") | |
legend(x = "topleft", legend = c("Train", "Train Predictions"), col = c("green", "red"), lwd = 3) | |
grid() | |
# Plot the loss of training data | |
plot(history$metrics$loss, type = "l", xlab = "Epochs",main="Training Loss", ylab = "Loss", col = "blue", lwd =3) | |
grid() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment