From 1a622f472e05f6e5e38ac952a5ce6f3f5835863f Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Sun, 8 Sep 2024 14:17:40 -0400 Subject: [PATCH] Adding missing get_policy and get_value to qlearning --- src/machine_learning/q_learning_agents.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/machine_learning/q_learning_agents.py b/src/machine_learning/q_learning_agents.py index 19e63d2..4d056f5 100644 --- a/src/machine_learning/q_learning_agents.py +++ b/src/machine_learning/q_learning_agents.py @@ -80,8 +80,10 @@ def update(self, state, action, next_state, reward): self.q_values[(state, action)] = self.get_Q_value(state, action) + self.alpha * (reward + self.discount*NSQ - self.get_Q_value(state, action)) + def get_policy(self, state): + return self.compute_action_from_Q_values(state) - - + def get_value(self, state): + return self.compute_value_from_Q_values(state)