simoninithomas/Deep_reinforcement_learning_Course

action = np.argmax(qtable[state,:]) :

aweichina opened this issue · 2 comments

It is a excellent work! Thank you simoninithomas!
When I trying the "Q* Learning with FrozenLake "
I received the error message:

 IndexError       Traceback (most recent call last)
<ipython-input-10-b80d2f0eee51> in <module>()
 
           17         ## If this number > greater than epsilon --> exploitation (taking the biggest Q value for this state)
           18         if exp_exp_tradeoff > epsilon:
      ---> 19             action = np.argmax(qtable[state,:])
           20 
           21         # Else doing a random choice --> exploration
   
  IndexError: arrays used as indices must be of integer (or boolean) type

I printed out the value of the state:
[ 0.01670674 -0.0137805 -0.02276666 0.02263872]

I don't know how to solute this problem.

Huh! I have solved this problem by adding ".numerator" behind state.
Like this:
action=np.argmax(qtable[state.numerator,:])