BackHow AI learns from data
In this post, we’ll walk through the main ways AI learns from data: supervised learning, unsupervised learning, and reinforcement learning. Each method has its own purpose, strengths, and quirks, and understanding them helps us appreciate how AI models become so good at their tasks.
Artificial intelligence
Data
AI learning
AI has been behind some impressive feats, from recommending songs we love to diagnosing complex medical conditions. But behind every successful AI model is a process of learning from data - sometimes tens of thousands of examples. But how exactly does AI learn?
At its core, AI is about recognising patterns in data. Think of it like teaching a child to recognise different types of animals. If you show them enough pictures of cats and dogs and tell them what each one is, they’ll start to get the hang of it. AI is similar, but instead of using intuition, it uses algorithms and mathematical models. The “learning” process involves feeding the AI a lot of data so it can create rules and patterns that allow it to make predictions about new information. The way we feed it this data and guide it through the learning process varies based on the type of learning we choose.
Supervised learning
Supervised learning is the most straightforward type of AI training and often the first one people think of. In supervised learning, the AI model is trained on labeled data—data that includes both the input and the correct output. Each example acts like a teacher, helping the model learn the “right answers” so it can recognize similar patterns in new data.
To understand supervised learning, let’s use an analogy. Imagine you’re teaching a dog to respond to commands like “sit” or “stay.” You show the dog the command (input) and guide it through the action (output), giving it treats when it gets it right. Eventually, the dog learns to associate each command with the correct action.In supervised learning, the AI is given examples of inputs and their corresponding outputs.
For instance, if we’re training an AI to recognise photos of cats and dogs, we’d feed it thousands of labeled images, each marked “cat” or “dog.” The model uses these labels to learn what a cat looks like versus a dog. By the end of training, it can identify a cat or dog in new, unlabeled images by applying what it learned from the labeled examples.
Supervised learning is especially useful when we have a large amount of labeled data and a clear goal. Here are some examples:
Email filters: An AI model trained to classify emails as “spam” or “not spam” based on labeled examples of each.
Medical diagnosis: Models that predict diseases by learning from labeled patient records (e.g., cases labeled as “disease” or “no disease”).
Image recognition: Identifying objects in images, like animals, cars, or plants, based on labeled training images.
Supervised learning can be incredibly powerful, but it depends heavily on having accurate labeled data. It’s a bit like learning with an answer key: if the labels are wrong, the AI will “learn” the wrong things.
Unsupervised learning
Unsupervised learning is a bit different; it doesn’t rely on labeled data. Instead, the AI is given unlabelled data and tasked with finding patterns or relationships within it. Think of it as giving the model a big box of puzzle pieces without the picture on the box and asking it to figure out how they fit together.
Let’s say you’re given a big box of photos but no information about what’s in them. Your task is to sort them into groups that seem to belong together - maybe by people, places, or time periods. You might start noticing that some photos have similar colours, people, or locations and group them accordingly. You don’t know the exact labels, but you can still organise them based on the patterns you observe.In unsupervised learning, the AI does something similar. It looks for patterns and similarities within the data to create clusters or groups. For instance, it might analyse a large dataset of customer purchases and group similar items together without knowing what each item is.
Unsupervised learning is ideal when we want to explore data and discover hidden patterns or relationships. Here are a few common examples:
Customer segmentation: AI models can analyse purchasing patterns to create customer groups with similar buying habits, even without knowing specific customer details.
Anomaly detection: Detecting unusual patterns, like identifying unusual bank transactions that could indicate fraud.
Data visualisation: Reducing large, complex datasets into simpler visual patterns that humans can easily interpret.
Unsupervised learning is great for finding hidden patterns, but it has limitations. Without labels, it can’t “check its work” to know if it’s found the correct answers. It’s an exploratory tool rather than a precise answer key.
Reinforcement learning
Reinforcement learning is a unique approach where AI learns through a system of rewards and punishments, much like a game. Rather than learning from labeled data, it learns by interacting with an environment and receiving feedback based on its actions. Over time, it adjusts its strategy to maximize rewards.
Picture yourself training a new puppy to fetch a ball. You throw the ball, and every time the puppy retrieves it, you give it a treat (reward). If the puppy ignores the ball, it doesn’t get a treat. Eventually, the puppy learns that fetching the ball leads to treats and starts doing it more often.Reinforcement learning works similarly. The AI is put in an environment where it can try different actions. Each action is either rewarded or punished based on how close it gets to the desired outcome. Over time, the AI learns which actions lead to rewards, adjusting its strategy to perform better.
One of the key concepts in reinforcement learning is called the reward function. This is the feedback system that tells the AI how well it’s doing, allowing it to learn from its successes and mistakes. Reinforcement learning is well-suited for situations where an AI needs to make a series of decisions to achieve a goal, particularly in dynamic environments. Here are some real-world examples:
Game-playing AIs: Models that play games like chess, Go, or even complex video games use reinforcement learning to develop winning strategies.
Robotics: Teaching robots to perform tasks, like stacking boxes or navigating around obstacles, where each action affects the next.
Self-driving cars: Cars learn to make safe driving decisions by receiving rewards for correct actions, like stopping at a red light, and punishments for mistakes.
Reinforcement learning is powerful but also challenging. It often requires a lot of time and computational resources, as the AI learns through trial and error. And if the reward system isn’t well-designed, the AI might “learn” to maximize rewards in unintended ways.
Bringing it all together
Choosing the right learning type depends on the problem. If you have clear, labeled data, supervised learning is often the best choice. If you’re exploring new data without clear answers, unsupervised learning helps uncover patterns. And if your goal involves a series of decisions leading to an end goal, reinforcement learning might be the way to go.
Imagine you’re using a virtual assistant, like Alexa or Siri, and you ask it to play a song you love. Supervised learning helps the assistant recognize your voice and understand the words you’re saying. It has been trained on thousands of labeled audio samples to convert your speech into text. Unsupervised learning helps it recommend similar songs or group playlists, even without explicit information about your preferences. Reinforcement learning guides the assistant to improve over time, as it learns from user feedback (e.g. you keep skipping certain songs) to offer better recommendations.
Learning is a mix of techniques, all working to create smart, adaptable systems that get better over time. Understanding these methods not only helps us appreciate the complexity behind AI but also gives us insight into its limitations. Each learning type has its strengths, and together, they allow AI to handle a wide variety of tasks and challenges in our data-filled world.