Q-Learning
التعلم بالقيمة Q
Definition
A reinforcement learning algorithm that learns the value of taking each action in each state without a model of the environment, from which it derives an optimal policy.
Definition
Q-learning is an off-policy temporal-difference reinforcement learning algorithm that learns the action-value function Q(s,a) and derives an optimal policy by acting greedily with respect to it.
Practical examples
alpha, gamma = 0.5, 0.9
q, r, q_next_max = 0.0, 1.0, 0.0
q = q + alpha * (r + gamma * q_next_max - q)
print(q)Expected output
0.5
Mathematical equations
Q(s,a)\leftarrow Q(s,a)+\alpha\left[r+\gamma\max_{a'}Q(s',a')-Q(s,a)\right]