Skip to content

Instantly share code, notes, and snippets.

@lsimmons2
Last active February 5, 2019 19:27
Show Gist options
  • Save lsimmons2/2a1ec000f2f7c8ccae552d76ab1a6365 to your computer and use it in GitHub Desktop.
Save lsimmons2/2a1ec000f2f7c8ccae552d76ab1a6365 to your computer and use it in GitHub Desktop.
def act(self, state):
if self.epsilon > np.random.rand():
# explore
return np.random.choice(ACTION_SPACE)
else:
# exploit - only use the online network to decide which action to take
# if allowed by epsilon/the exploration factor
state = self._reshape_state_for_net(state)
q_values = self.online_network.predict(state)[0]
return np.argmax(q_values)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment