Reinforcement Learning (RL)
Reinforcement learning is a type of machine learning where an agent learns by trial and error, taking actions in an environment and receiving rewards or penalties, then adjusting to maximize total reward.
Data & AI
Unlike supervised learning, there are no labeled answers — the agent discovers good behavior through feedback over time. It must balance exploration (trying new things) with exploitation (using what already works).
It works much like training a dog with treats: good actions earn rewards, bad actions don't, and over many attempts the agent learns a strategy (called a policy). RL powers game-playing AIs and robotics, and helps fine-tune large language models.
Examples
Python — The agent repeatedly acts, observes a reward, and updates its policy.
# Sketch of the RL loop
state = env.reset()
for step in range(1000):
action = agent.choose(state)
state, reward, done = env.step(action)
agent.learn(state, action, reward)
if done:
break