Near-optimal Regret Bounds for Reinforcement Learning