Reinforcement learning (RL) is concerned with how the
machine learning models can train agents to make decisions in an environment by
performing actions and monitoring the results. For every good action, the agent
gets rewards, and for every bad action, the agent gets penalties. In short, RL
models learn by trial and error to make better decisions in the future.
There are 5 key components in Reinforcement learning:--
a) Agent: An entity which performs
action
b) Environment: The world or system
in which the agent operates.
c) State: The situation or
condition the agent is currently in.
d) Action: The different choices
that the agent can make
e) Reward: The
result from the environment based on the agent’s action.
This Machine Learning category can be implemented by following the below approaches--
- Value-Based Models
- Policy-Based Models
- Model-Based Reinforcement Learning
- Deep Reinforcement Learning Models
In this article, we will talk about the functionality of the Models used in each of the above categories.
Value-Based Models
This RL category focuses on learning the value of states or state-action pairs to derive an optimal policy. The goal is to maximize the value function, which represents the long-term cumulative reward.
Q-Learning
Q-Learning is a model free RL algorithm that helps an agent learn how to make the best decisions by interacting with the environment. “Q” stands for Quality which represents how valuable the action is in maximizing future rewards.
The working of this model is through a set of key components as illustrated in the diagram below:
SARSA
SARSA stands for State-Action-Reward-State-Action, which helps an agent to learn an optimal policy by interacting with the environment. Being the modified version of the Q-learning, it learns from the actual action taken by agent.
The main idea behind SARSA is trial and error. The agent takes an action in a situation, observes the result, and adjusts its strategy based on the outcome. This process is repeated many times, leading to improvements in the agent’s decisions over time.
The Update Equation rule used in SARSA is—
- Q(s,a) = Current estimate of action value
- α = Learning rate
- γ = Discount factor
- r = Immediate reward
- Q(s',a') = Value of the next state-action pair actually chosen
Policy-Based Models
The models in this segment directly learn and optimize the policy mapping states to actions, often using gradient-based methods for continuous or stochastic action spaces.
REINFORCE
The key working steps involved in this algorithm are as follows:--
a) Collect Episodes: The agent interacts with the environment, generating trajectories of states, actions, and rewards.
b) Calculate Returns: For each time step, compute the discounted cumulative reward (return) from that point onward.
c) Policy Gradient Update: Update the policy parameters using the gradient of the log-probability of actions, weighted by the returns.
d) Repeat: Iterate over multiple episodes to refine the policy.
Vanilla Policy Gradient (VPG)
The working process of the VPG algorithm is as follows—
Model-Based Reinforcement Learning
In this type of Reinforcement Learning, the agent uses the model of environment to predict what will happen after taking actions, and then uses those predictions to choose better actions.
Dyna-Q
- Estimated value of each state-action
- What it has learned about the environment
a) Initialize the Q-table and an empty model (which will store transitions).b) Take an action in the environment → observe reward and next state.c) Real Experience Update: Update the Q-value using the Q-learning rule.d) Update the Model: Record the observed transitione) Planning Step:
- Randomly sample a few previously observed state-action pairs.
- Use the model to simulate what would happen next.
- Apply the same Q-learning update using the simulated data.
f) Repeat steps b)–e) until convergence.
World Models
This approach involves creating a model that simulates the
environment's dynamics using past experiences. It often employs recurrent
neural networks (RNNs) to learn the transition function f(s,a) from state s and
action a.
World Models has following categories—
a) Explicit models: The model directly
predicts environmental quantities. This is useful when the state is well
defined.
b) Latent models: The model predicts
future latent representations, rather than reconstructing the complete
environment.
c) Probabilistic models: Instead of
predicting one future, the model represents uncertainty. This is useful when
the environment is stochastic.
Deep Reinforcement Learning Models
Deep Reinforcement Learning (Deep RL) combines reinforcement learning (RL) with deep neural networks. It enables an agent to learn how to make decisions directly from complex data such as images, sensor readings, or large state spaces.
Deep Q
Network (DQN)
DQN in reinforcement learning is a combination of deep
neural networks and Q-learning that enables agents to learn optimal policies in
complex environments. Unlike tabular Q-learning, which stores Q-values in a
table, DQN learns a function approximation.
The core components used in DQN architecture are as follows—
b) Hidden Layers: consist of multiple fully connected neuron that transform the input data into more complex features that are more suitable for predictions.
c) Output Layer: Each possible action in the current state is represented by a single neuron in the DQN's output layer. The output values of these neurons represent the estimated value of each action within that state.
Proximal Policy Optimization (PPO)
PPO is a policy optimization algorithm that trains an agent
to make better decisions by directly improving its policy (the mapping from
states to actions). The key idea is to update the policy gradually and prevent
it from changing too much in a single training step.
The training cycle behind PPO is as follows—
a) Agent interacts with environment.
b) Collect trajectories (state, action, reward).
c) Compute advantages (how good an action was).
d) Update policy network using PPO objective.
e) Repeat until convergence.
Conclusion
Overall, Reinforcement Learning is a powerful Machine Learning technique that allows agents to learn from rewards and penalties. The models discussed in this article demonstrate different ways of achieving effective decision-making.
No comments:
Post a Comment