Last active
January 14, 2020 12:37
-
-
Save pythonlessons/7cf28805201a8bc166fefbfcaaa02f71 to your computer and use it in GitHub Desktop.
02_CartPole-reinforcement-learning_DDQN
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
def update_target_model(self): | |
if not self.Soft_Update and self.ddqn: | |
self.target_model.set_weights(self.model.get_weights()) | |
return | |
if self.Soft_Update and self.ddqn: | |
q_model_theta = self.model.get_weights() | |
target_model_theta = self.target_model.get_weights() | |
counter = 0 | |
for q_weight, target_weight in zip(q_model_theta, target_model_theta): | |
target_weight = target_weight * (1-self.TAU) + q_weight * self.TAU | |
target_model_theta[counter] = target_weight | |
counter += 1 | |
self.target_model.set_weights(target_model_theta) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment