Everything You Need To Know About Reinforcement Learning


Original Source Here

Everything You Need To Know About Reinforcement Learning

Photo by Pat Krupa on Unsplash

Reinforcement learning is the process of educating machine learning models to make a series of judgments. In an uncertain, possibly complicated environment, the agent learns to attain a goal. An artificial intelligence is put in a game-like environment in reinforcement learning. The computer uses trial and error to find a solution to the problem. To persuade the computer to do what the programmer desires, the artificial intelligence is compensated for the acts it does. Its objective is to maximize the entire reward.
Although the developer establishes the reward policy–that is, the game rules–he provides no tips or suggestions to the model about how to complete the game. It is up to the model to discover out how to accomplish the job in order to maximize the reward, beginning with completely random trials and progressing to complex tactics and superhuman abilities.

Reinforcement Learning Scinario

Standard scenario of reinforcement learning
  • Agent — It is a fictitious entity that acts in a certain environment in order to obtain a reward.
  • Environment (e) — A situation that an agent must deal with.
  • Reward (R) — An instantaneous reward offered to an agent for completing a specified action or activity.
  • State (s) The term “state” refers to the present situation as indicated by the environment.

What is the process of Reinforcement Learning?

Reinforcement learning example

Let’s look at some easy examples to assist you understand the reinforcement learning mechanism. Consider the scenario of training a dog new tricks.

  • We can’t instruct the dog what to do because he doesn’t comprehend English or any other human language. Instead, we use a different approach.
  • We simulate a situation, and the dog attempts to respond in a variety of ways. If the dog responds in the desired manner, we will reward him with a treat.
  • When the dog is exposed to the same circumstances again, he does a comparable activity even more excitedly in the hope of receiving additional reward (food).
  • That’s similar to how a dog learns “what to do” through favorable experiences.
  • Simultaneously, the dog learns what not to do when confronted with unfavorable events.

Reinforcement Learning Algorithms

A Reinforcement Learning algorithm can be implemented in three ways.

Model-Based Methods

A basic approach: if we don’t know the MDP, we may estimate it from data. The agent behaves in the environment (according to some policy) and observes state, actions, and reward sequence.

reward sequence

Using the counts, create an empirical estimate of the MDP.

empirical estimate

Then solve MDP M̂ = (𝒮,𝒜,𝑃̂,𝑅̂,𝛾) via e.g., value iteration

Value-Based Methods

You should strive to optimize a value function V(s) in a value-based Reinforcement Learning method. In this strategy, the agent anticipates a long-term return of the current states under policy π.

Policy-Based Methods

In a policy-based RL method, you strive to devise a policy in which every action taken in each state helps you obtain the most reward in the future.

There are two kinds of policy-based methods:


Reinforcement Learning Varieties

Positive reinforcement and negative reinforcement are the two types of reinforcement learning varieties.

Positive reinforcement

The technique of encouraging or adding something when a predicted behavior pattern is demonstrated in order to improve the chances of the same behavior being repeated is known as positive reinforcement learning.

For example, if a child performs well on a test, they can be positively rewarded with an icecream.

Negative reinforcement

Negative reinforcement entails raising the likelihood of a given behavior recurring by removing the negative circumstance.

For example, if a child fails a test, he or she might be negatively reinforced by being denied access to video games. This is not exactly punishing the child for failing the exam, but rather removing a negative situation (in this example, video games) that may have led the child to fail the exam.

Reinforcement Learning Models

In reinforcement learning, there are two main learning models.

Markov Decision Process

A Markov decision process is a tuple

consisting of:

  • S is a collection of states. (For example, in autonomous helicopter flight, S may be the set of all potential helicopter locations and orientations.)
  • A is a collection of actions. (For example, the set of all conceivable directions in which the helicopter’s control stick may be pushed.)
  • The probabilities of state transition are denoted by Psa. Psa is a distribution across the state space for each state s ε S and action a ε A. Psa represents the distribution of states to which we will migrate if we do action an in state a.
  • Γ ε [0, 1) is called the discout factor.
  • R : S x A → ℝ is the reward function. (Rewards are sometimes also written as a function of a state A only, in which case we would have R : S → ℝ)

The mathematical method for mapping a solution in reinforcement learning Learning is reconstructed as a Markov Decision Process or as a (MDP).


Q-learning is an Off policy RL algorithm used for temporal difference learning. The temporal difference learning methods compare temporally consecutive predictions. It learns the value function Q (S, a), which describes how good it is to execute action “a” at a given state “s.”

The Bellman equation may be used to calculate the value of Q-learning. Consider the following Bellman equation:

There are several components in the equation, including reward, discount factor (Y), probability, and end states s’. However, no Q-value is provided, so examine the illustration below:

In the figure above, we can see an agent with three value options: V(s1), V(s2), and V(s3). Because this is MDP, the agent is solely concerned with the current and future states. Because the agent may walk in any direction (Up, Left, or Right), he must select where to travel for the best path. In this case, the agent will make a move based on probability and modify the state. However, if we want any precise movement, we must make some alterations in terms of Q-value. Consider the following image:

Q- represents the level of quality of the acts in each state. So, rather than utilizing a value at each state, we will use a pair of state and action, i.e., Q. (s, a). The Q-value describes which actions are more lubricative than others, and the agent makes his next move based on the optimum Q-value. The Q-value may be calculated using the Bellman equation.

Hence, we can say that, V(s) = max [Q(s, a)]

The flowchart below demonstrates how Q-learning works:

What is the distinction between Reinforcement Learning and Supervised Learning?

Applications of Reinforcement Learning


The difficulty of learning control methods for autonomous agents with little or no data is addressed by Reinforcement Learning. Because collecting and labeling a wide collection of sample patterns costs more than the data itself, RL algorithms are useful in machine learning. RL is always learning, so it grows better and better at the task at hand. Under supervised learning, learning a chess game can be a time-consuming effort, yet RL works quickly on the same job. The trial-and-error strategy of attempting a task with the purpose of maximizing long-term reward can produce superior outcomes in this case. Dynamic programming techniques to Markov decision processes are closely linked to reinforcement learning (MDP).


Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot

%d bloggers like this: