A collection of fragments of understanding in the pursuit of deeper questions.
Introduction to Reinforcement Learning
![]() |
![]() |
|---|
We saw the concept of looking at expected reward and choosing actions to maximize this reward, but the idea was not well embedded into a generalizing concept. Reinforcement Learning (RL) exactly puts a name on this framework, which includes Q-Learning as well. RL is about an agent taking suitable action to maximize reward in a particular situation. It is employed by various software and machines to find the best possible behavior or path it should take in a specific situation.
In the pictures: influences from and to the agent in RL to the surrounding world. At each step t, the agent executes an action which the environment receives. The agent receives an observation of the environment, for example through a sensor and the agent is rewarded by its behavior from the environment.
Reinforcement Learning is based on the reward hypothesis: All goals of an agent can be described by the maximization of expected cumulative reward. A reward is a scalar feedback signal. It indicates how well the agent is doing at step t. The agent's job is to maximize cumulative reward.
Example rewards:
The Goal is to select actions that maximize total future rewards:
The fact that reward presented to the agent is not always immediate leads to the exploration/exploitation dilemma. An agent does not intrinsically know the future implications of its actions, or the dynamics of the environment.
The Agent State
At each point in time, the agent is in a state, because this information state is all that is necessary to fully determine the agent, it is also said that the state is markovian. This means we can throw away the history ( of previous actions, observations and rewards:
For the reasons explained above: . An RL agent may compute different functions on top of its state. An RL agent may include one or more of these components:
Policy The agents behavior function called policy maps from state s to action a. The policy may be stochastic or deterministic:
Value Function The value function is a prediction of future rewards and does so by assigning a number to every state s, it is used to evaluate the goodness/badness of states. It depends on a policy to determine where the agent could go and a probability distribution . We compute this value as an expectation over the joint distribution: .
The value function is defined as:
In the lecture slides is formulated as:
Model A model predicts what the environment will do next. From the previous section we see that we require a probability distribution that depends on direct actions a or a policy returning action :
That predicts the next (immediate) reward:
In the lecture slides is formulated as:
where P predicts the next state and R predicts the next (immediate) reward.
This is called the model. Model free RL uses tricks to not compute/require this distribution. As it is often intractable (Imagine the state space being the input of a video game).
In the image, a small example of a mice showing all the agent related components together with some numbers. (Top left) Actions, start, end and definition of other states (the maze). (Top right) Immediate rewards. (Bottom) Policy and Value Function for each state.
We have seen different RL-subtypes that need to be distinguished. Comment: from the Bellman Theorem we know that every value function induces a policy and every policy induces a value function:
A more sophisticated example is represented by the Atari Games. The Atari video-gaming platform provides an ideal environment to test RL/Planning strategies. For some games, we don't know the rules and apply RL. This means we learn directly from interactive gameplay. Pick actions on a joystick and observe the pixels. For other games we know the rules. This allows to apply planning strategies where we might ask ourselves: What would the next state be? What would the score be? We can query the future by tree search to some extent.
Planning Even though planning appear later in the lecture it is actually the logical step before we arrive at RL. It is a more constrained view where a model of the environment is known. The agent performs computations with its model (without any external interaction). This is a simplification compared to RL where the environment is initially unknown and the agent may only discover it. By interacting with the environment. In RL, the agent improves its policy or value function. If the agent/solver has access to the model, i.e., and , and it employs it when optimizing the MDP, then we are in the planning settings (or dynamic programing, DP, setting). Otherwise, we are in the RL settings. Of course, sometimes, even though we have access to the model, still we do RL since it is hard to solve directly the MDP, and we prefer to interact with the MDP rather than solving it, i.e., we ignore the model. In a planning scenario, we can query the future through the emulator. We can therefore play/plan ahead to find the optimal policy by tree search. As already mentioned, this might not be possible even for simple games. RL on the other hand can be as well referred to as "trial-and-error" learning. However, obviously we try to guide the agent to lose the least amount of reward that is possible.
Exploration / Exploitation Everyone is confronted with the same dilemma on a daily basis: should I keep doing what I do, or should I try something else. For example should I go to my preferred restaurant or should I try a new one, should I keep my current job or should I find a new one, etc...
In Reinforcement Learning, this type of decision is called exploitation when you keep doing what you were doing, and exploration when you try something new.
Basics Remark: In my opinion these chapters build the foundation for RL but in the lecture they appear after RL and thus I kept that order. If you are a beginner to these topics, I highly recommend to gain some basic knowledge about probabilistic graphic models (PGM) (Bayesian Networks) first. They are used from here on, but were not introduced explicitly in the lecture.