Skip to content

Commit

Permalink
Rename greedy_policy to epsilon_greedy_policy
Browse files Browse the repository at this point in the history
  • Loading branch information
fayimora committed Mar 18, 2015
1 parent 211f3ec commit baf9901
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mc_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# if our random value > epsilon, then pick HIT or STICK, depending on which action is better (exploitation)
# else randomly return HIT or STICK (exploration)
def greedy_policy(action_value, state, epsilon):
def epsilon_greedy_policy(action_value, state, epsilon):
HIT, STICK = 1, 0
if random() > epsilon:
hit_value = action_value[(state.dealer, state.player, HIT)]
Expand Down Expand Up @@ -69,7 +69,7 @@ def plot_value_function(value_function, title):
dealer = state.dealer

epsilon = float(n_zero) / (n_zero + n_states[(dealer, player)])
action = greedy_policy(action_value_function, state, epsilon)
action = epsilon_greedy_policy(action_value_function, state, epsilon)

n_states[(dealer, player)] += 1
n_state_actions[(dealer, player, action)] += 1
Expand Down

0 comments on commit baf9901

Please sign in to comment.