I'm exploring how an LSTM solves the problem of vanishing gradients. I have created a simple LSTM model on keras. I know that model.fit() returns a history object that stores model loss and accuracy which can then be plotted with respect to the epochs. Is there a similar way to plot gradient descent. Does History store the value of the gradients after every epoch?


closed as off-topic by Sycorax, kjetil b halvorsen, Michael Chernick, mdewey, Ben Mar 14 at 5:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Sycorax, kjetil b halvorsen, Michael Chernick, Ben
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ What do you mean by plotting the gradient descent? I will still have a guess and say that you are interested in the change in the weights (not the actual gradient, although you can get one from the other by using the learning rate). If so, then you can just access the weight values at each iteration or epoch and plot that? $\endgroup$ – Tom Mar 11 at 23:23
  • $\begingroup$ @Tom Thank you! I meant the actual gradients. Could you please elaborate on how I would be able to find the gradients by using the learning rate? Plotting the weights also seems like a good solution, but how would I plot all the weight values at each iteration since there are so many and won't I be restricted to the weights of a single layer only? $\endgroup$ – Mukul Patnaik Mar 13 at 2:42