No history yet

Introduction to Reinforcement Learning

Learning from Experience

Imagine teaching a dog to fetch. You don't give it a manual on how to run, pick up a ball, and bring it back. Instead, you throw the ball. If the dog brings it back, you give it a treat. If it runs off and buries the ball, it gets nothing. Over time, the dog learns that bringing the ball back leads to a reward.

This is the core idea behind reinforcement learning (RL). It's a type of machine learning where an intelligent 'agent' learns to make decisions by performing actions in an 'environment' to achieve a goal. The agent learns from the consequences of its actions, just like the dog learning to fetch.

In RL, the goal is to learn the best strategy, or 'policy,' for making decisions by maximizing a cumulative reward over time.

This loop is fundamental. The agent takes an action. The environment changes, and the agent gets a new observation and a reward (or penalty). This process repeats, allowing the agent to learn which actions lead to the best outcomes through trial and error.

How RL is Different

You might be familiar with two other main types of machine learning: supervised and unsupervised.

Supervised learning is like studying with flashcards that have the answers on the back. The model is given labeled data—inputs paired with the correct outputs—and learns to map one to the other.

Unsupervised learning is like being given a big box of mixed LEGO bricks and asked to sort them into piles. There are no labels or 'correct' answers. The model finds patterns and structures in the data on its own.

Reinforcement learning is a different beast altogether. There's no answer key. The agent must discover the best actions by exploring the environment and learning from the feedback it receives.

FeatureSupervised LearningUnsupervised LearningReinforcement Learning
DataLabeled dataUnlabeled dataNo predefined dataset
GoalPredict outputs from inputsFind hidden structureMaximize cumulative reward
FeedbackDirect, from labelsNoneDelayed, from rewards
LearningFrom an expert 'teacher'By finding patternsThrough trial and error

The key distinction is that RL deals with sequential decision-making. An action taken now can affect not just the immediate reward, but all future rewards as well. It’s about playing the long game.

Lesson image

RL in the Real World

Reinforcement learning isn't just a theoretical concept; it's the driving force behind some incredible technological achievements.

One of the most famous examples is AlphaGo, a program that defeated the world's best Go players. Go is a game with more possible moves than atoms in the universe, so it's impossible to brute-force a solution. AlphaGo learned by playing millions of games against itself, using reinforcement learning to discover winning strategies that no human had ever considered.

Robotics is another major area for RL. Instead of programming a robot's every movement, engineers can use RL to let the robot learn how to walk, run, or manipulate objects on its own. This makes robots more adaptable to new and changing environments.

Lesson image

But RL goes beyond games and robots. It's used to optimize traffic light control systems to reduce congestion, create personalized recommendation systems on streaming services, and even manage energy consumption in data centers. Anytime a system needs to make a sequence of decisions to optimize for a long-term goal, RL is a powerful tool for the job.

Quiz Questions 1/4

What is the core idea behind how a reinforcement learning agent learns?

Quiz Questions 2/4

Which of the following scenarios is the best example of a reinforcement learning problem?

Now that you've got the basics down, you can see how RL provides a framework for teaching machines to master complex tasks by interacting with their world.