Learning the Q value function