Reinforcement Learning Algorithms
How AI learns through trial, error, and reward — just like training a dog or playing a video game.
Observe State
The agent perceives the current state of the environment (e.g., game board positions).
Choose Action
Based on its policy, the agent picks an action (e.g., move left, jump, trade).
Get Reward
The environment gives a reward (+1 for good, -1 for bad) based on the action taken.
Update Policy
The agent updates its internal strategy to maximize future cumulative rewards.
Key Algorithms
Q-Learning
Classic video games, simple navigation tasks.
Deep Q-Network (DQN)
Atari games — learned to play at superhuman level.
Proximal Policy Optimization (PPO)
OpenAI Five (Dota 2), robotic locomotion.
Reinforcement Learning (RL) uses a Reward/Penalty system. An 'Agent' explores an 'Environment' to maximize its total reward.
1. Q-Learning & DQN
Q-Learning stores value tables for actions. Deep Q-Networks (DQN) use Neural Networks to solve complex problems like playing video games.
Python: Basic RL Concept
A simple loop showing how an agent learns from rewards (Conceptual):
class SimpleAgent:
def __init__(self):
self.knowledge = 0
def act(self, action):
# Action 1 = Study, Reward = 10
# Action 0 = Sleep, Reward = 2
reward = 10 if action == 1 else 2
self.knowledge += reward
return reward
agent = SimpleAgent()
for day in range(5):
r = agent.act(day % 2) # Alternate study/sleep
print(f"Day {day}: Reward gathered = {r}")