mirror of
https://github.com/gryf/coach.git
synced 2025-12-17 19:20:19 +01:00
bug fix - preventing crashes when the probability of one of the actions is 0 in the policy head
This commit is contained in:
@@ -73,7 +73,7 @@ class PolicyGradientsAgent(PolicyOptimizationAgent):
|
||||
else:
|
||||
action = np.argmax(action_values)
|
||||
action_value = {"action_probability": action_values[action]}
|
||||
self.entropy.add_sample(-np.sum(action_values * np.log(action_values)))
|
||||
self.entropy.add_sample(-np.sum(action_values * np.log(action_values + eps)))
|
||||
else:
|
||||
# CONTINUOUS
|
||||
result = self.main_network.online_network.predict(observation)
|
||||
|
||||
Reference in New Issue
Block a user