mirror of
https://github.com/huggingface/deep-rl-class.git
synced 2026-05-01 06:10:01 +08:00
Merge pull request #354 from andywalner/random-int-fix
change int to float
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user