From b76c37c57af7290ed077b0327ad518d5a6988ea7 Mon Sep 17 00:00:00 2001 From: Andy Walner <30377815+andywalner@users.noreply.github.com> Date: Sun, 25 Jun 2023 12:43:45 -0400 Subject: [PATCH 1/2] change int to float --- notebooks/unit2/unit2.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebooks/unit2/unit2.ipynb b/notebooks/unit2/unit2.ipynb index 2fd2530..76cc824 100644 --- a/notebooks/unit2/unit2.ipynb +++ b/notebooks/unit2/unit2.ipynb @@ -695,9 +695,9 @@ "source": [ "def epsilon_greedy_policy(Qtable, state, epsilon):\n", " # Randomly generate a number between 0 and 1\n", - " random_int = random.uniform(0,1)\n", - " # if random_int > greater than epsilon --> exploitation\n", - " if random_int > epsilon:\n", + " random_float = random.uniform(0,1)\n", + " # if random_float > greater than epsilon --> exploitation\n", + " if random_float > epsilon:\n", " # Take the action with the highest value given a state\n", " # np.argmax can be useful here\n", " action = greedy_policy(Qtable, state)\n", From 255112a2eb1cda4e24d51f7a4e3fa37640971024 Mon Sep 17 00:00:00 2001 From: Andy Walner <30377815+andywalner@users.noreply.github.com> Date: Mon, 26 Jun 2023 07:18:21 -0700 Subject: [PATCH 2/2] random_num --- notebooks/unit2/unit2.ipynb | 6 +++--- units/en/unit2/hands-on.mdx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/notebooks/unit2/unit2.ipynb b/notebooks/unit2/unit2.ipynb index 76cc824..2ff7a9d 100644 --- a/notebooks/unit2/unit2.ipynb +++ b/notebooks/unit2/unit2.ipynb @@ -695,9 +695,9 @@ "source": [ "def epsilon_greedy_policy(Qtable, state, epsilon):\n", " # Randomly generate a number between 0 and 1\n", - " random_float = random.uniform(0,1)\n", - " # if random_float > greater than epsilon --> exploitation\n", - " if random_float > epsilon:\n", + " random_num = random.uniform(0,1)\n", + " # if random_num > greater than epsilon --> exploitation\n", + " if random_num > epsilon:\n", " # Take the action with the highest value given a state\n", " # np.argmax can be useful here\n", " action = greedy_policy(Qtable, state)\n", diff --git a/units/en/unit2/hands-on.mdx b/units/en/unit2/hands-on.mdx index f8dd666..e3f3212 100644 --- a/units/en/unit2/hands-on.mdx +++ b/units/en/unit2/hands-on.mdx @@ -388,9 +388,9 @@ def epsilon_greedy_policy(Qtable, state, epsilon): ```python def epsilon_greedy_policy(Qtable, state, epsilon): # Randomly generate a number between 0 and 1 - random_int = random.uniform(0, 1) - # if random_int > greater than epsilon --> exploitation - if random_int > epsilon: + random_num = random.uniform(0, 1) + # if random_num > greater than epsilon --> exploitation + if random_num > epsilon: # Take the action with the highest value given a state # np.argmax can be useful here action = greedy_policy(Qtable, state)