I'm new to reinforcement learning and trying to understand it.

If you train an agent using a reinforcement learning algorithm (discrete or continuous) on an environment (real or simulated), then how do you know if the agent has learnt its environment? Should it reach its goal on every run (episode)? (Any literature references are also welcome)

Is this related to the reward threshold defined in the environment?

What happens if you continue training after the agent has learnt the environment? Will it perform by reaching its goal every time or will there be failed episodes?


1 Answer 1


This depends on the complexity of the environment being learned, and the purpose for learning it. There is no general answer.

For the simple environments used to teach reinforcement learning (RL), often the optimal solution is obvious, or can be calculated and proven optimal. For instance, any environment that can be solved using policy iteration will have a known optimal policy and optimal value function. The goals of these environments are to teach, or to check correctness of agents - it helps in these cases to have a well known correct answer.

At the next level up in terms of complexity are well-studied environments which can have achievable targets set for learning agents. The goals of these environments include getting useful metrics for learning agents, such as how many episodes it takes a particular implementation to learn it well enough. Defining "well enough" is a matter of experience with existing agents.

Getting more complex still, in general it is not possible to know whether an agent has fully optimised against its environment. The subject area of sequential decision making that includes RL agents can cover scenarios such as driving a car or playing a computer game. We don't know when any agent, whether they are based on RL or some other approach, has fully learning an environment, and instead must construct tests of behaviour - e.g. make an agent simulate driving in a set of scenarios, and expect at least safe behaviour in each of them, essentially a driving test similar to one a person might take. In these environments, often the tests are based on "good enough to use" goals. We can say an agent has learned to drive if it drives more safely than an average human.

In the special case of competitive games, we can score agents against each other or against human players. You might say that an agent has learned its environment if it beats some standard player, but also you can rank agents against each other and declare a particular agent as the current best.

It is possible to mix and match these ideas. The Atari games learning suite has benchmark scores to reach that count as "standard human", and recently agents have been published that beat all of those scores.

What happens if you continue training after the agent has learnt the environment? Will it perform by reaching its goal every time or will there be failed episodes?

If you include training episodes, then RL learns mainly by "trial and error". So you should expect an agent to make deliberate mistakes as it tests to see what happens. In some environments these could be critical mistakes leading to failed episodes.

If you ignore the training episodes and are interested only in performance without exploration - e.g. testing every few hundred episodes - then you can expect performance to vary depending on the type of agent and environment. Some agents even exhibit "catastrophic forgetting", which as the name implies causes performance to drop significantly - this can be caused by a successful agent over-fitting to all the recent successful episodes without errors it just experienced, and losing the ability to predict the true lower value of incorrect actions.

Neither failed episodes during training nor catastrophic forgetting are inevitable. It depends on the environment and type of agent.

  • $\begingroup$ Thank you for the detailed answer. Please tell me what is the difference between training and testing (aka evaluation if I understood correctly)? As I see it, both imply the same procedure: select an action, apply to the environment, get reward and state... $\endgroup$
    – Cristian M
    May 4, 2020 at 13:23
  • $\begingroup$ @CristianM: During training the agent will - with some probability - deliberately take actions that it currently evaluates as not optimal, in order to refine its understanding of them (maybe its estimates are wrong, it can only find out by trying). This can reduce its performance. That is what I am referring to in the paragraph starting "If you include training episodes . . ." $\endgroup$ May 4, 2020 at 14:00
  • $\begingroup$ OK. I am referring in a general sense. I will post a separate question for this. $\endgroup$
    – Cristian M
    May 4, 2020 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .