I managed to get “C3_W3_A1_Assignment.ipynb” to work locally.
I read the lesson again and the code. And I wonder why setting a specific adam optimizer while only updating gradients afterward?
Any optimizer would not work as well as far as we don’t run any optimization with it in the whole code?
Or maybe I missed something hidden in the other files.
Or something I missunderstood?
The Adam optimizer did its part in the agent_learn function when we called its apply_gradient method. If we didn’t have this line of code, no weight update would have happened to the Q network.
is actually calling the optimizer and then the model performs all Adam refinements each time it runs and is not only strictly applying the computed gradients.
If model.compile() or model.fit() are not executed, the model is not trained, and therefore, the optimization process, including adaptation, does not occur. The optimizer’s parameters remain unchanged until the model is compiled and trained.
And also that:
Applying Gradients : After computing the gradients, you call the optimizer’s apply_gradients() method, passing it the gradients along with the corresponding model parameters. The optimizer then applies these gradients to update the model’s parameters according to its optimization algorithm.
when optimizer.apply_gradients() is called, the optimizer refines not only the learning rates but also any other parameters it maintains, such as momentums.
So ‘apply_gradients()’ does not only apply gradients straight away but using optimizer full capabilities and keeps a track of previous steps.
Yes. adam.apply_gradient does apply the gradients in the manner of Adam. We utilize our optimizer this way when we have a customized training process - getting new (s, a, r, s) tuples and soft-updating Target Q Network. These customized processes are not in the standard training procedure initiated by model.compile and model.fit.
There should be a “Solution” button but somehow this and some of the other buttons just don’t show up in some of the threads… It’s quite mysterious to me too