We ❤️ Open Source

A community education resource

9 min read

What is Machine Learning and how does AI actually learn?

From Netflix to robots: How AI learns, improves, and sometimes fails—depending on its data.

If AI isn’t programmed with strict rules to follow, then how does it actually learn?

That’s where Machine Learning (ML) comes in. Unlike traditional programming, where we tell a system exactly what to do, ML lets AI figure things out on its own by spotting patterns in data and improving over time.

Take self-driving cars, for example. They don’t come pre-programmed with a list of 100% crash proof rules or every possible road scenario. That would be impossible, because let’s be real, the scariest part of driving is the unexpected. Instead, they learn by analyzing a lot of real road data, running thousands of simulations, and making split-second decisions.“Should I turn left here? Speed up? Stop for that pedestrian?” and it adjusts based on what works. The more it learns, the better and hopefully the safer it gets.

At its core, Machine Learning is just pattern recognition on overdrive. Instead of us programming every single rule, we give AI a ridiculous amount of data, and it figures out what works and what doesn’t.

The more data AI sees, the smarter it gets. And honestly, it’s the same for us, the more experience we have, the better we get at literally anything.

Read more: What is Artificial Intelligence (AI) and the three things it does well

3 main types of Machine Learning

But just like we don’t all learn the same way, AI doesn’t either. Some of us are visual learners, while others learn best by getting their hands dirty, and AI has its own learning methods, too.

Supervised learning

Supervised learning is similar to studying with flashcards. AI is given examples where the correct answer is already known because they’re labeled. I remember in high school, I would test myself both ways, starting with the definition and guessing the word, then flipping it around and seeing if I could recall the definition from just the word. AI learns in a similar way just with a lot more data.

Take medical diagnosis for an example. If we want AI to help doctors detect diseases, we train it using thousands of past medical records. Some of these records are labeled with “this patient has pneumonia,” while others are labeled “this patient is healthy.” Over time, AI starts recognizing patterns, maybe certain spots in X-rays or certain markers in blood tests tend to show up in pneumonia cases. Then, when a new patient comes in, AI can simply analyze their medical data and say, “This looks similar to past pneumonia cases, you might want to check this bad boy out.” It’s not replacing doctors, but it is making their jobs easier by helping them catch diseases earlier.

This method of learning is great when we have tons of labeled data and we need AI to predict clear answers. But what if we don’t have labeled examples? What if AI has to figure things out on its own? That’s where unsupervised learning comes in.

Unsupervised learning

Unsupervised learning is when AI figures things out on its own, without any labels, or instructions, its simply given raw data. So instead of being told exactly what to look for, it finds patterns again, by itself. Kind of like putting together a puzzle when your toddler loses the top of the box, so now you have no idea what the puzzle is even supposed to be… yeaaa … just like that.

Streaming platforms work the same way. No one sits down and manually sorts people into “sci-fi lovers” or “rom-com lovers.” Instead, AI looks at everyone’s watching habits, who binges what, who rewatches what, and who bails after the first 10 minutes, and starts grouping similar viewers together. If a bunch of people who love “Stranger Things” also end up watching “Black Mirror”, Netflix figures, “Okay, these type of shows probably interest this type of audience.”

That’s how your recommendation section keeps hitting you with hit, after hit, after hit, keeping you glued to your screen. So technically, we can blame AI for why you’ve been on Netflix for the past 10 hours instead of going to the gym.

While Unsupervised learning is all about discovering patterns, Reinforcement learning is all about learning through action. Instead of just analyzing data, AI takes action, gets feedback, and improves over time.

Reinforcement learning

Reinforcement learning is basically trial and error, but for AI. It makes a decision, receives feedback on whether it was a “smart” or “not smart” move, and it adjusts next time. Just like in real life, good decisions are rewarded, and bad ones come with consequences, so AI learns fast. These rewards are usually numbers, AI gets a higher score for smart choices and a lower score when it messes up, which helps it improve over time. I feel like this form of learning is something everyone goes through whether its your first few months at a new job, or when you learn a new skill , there’s always a form of trial and error.

Have you ever seen those videos of robots trying and failing to walk? That’s reinforcement learning in action. At first, they stumble around a little, but every step teaches the AI something new, like adjusting balance, shifting weight, and improving coordination. Some robots use Reinforcement learning, while others combine it with pre-programmed movement models to learn even faster. So before you know it they’ll be running, jumping, or even doing backflips.

Reinforcement learning isn’t just for robots, it’s also making buildings smarter. Google trained an AI system to reduce energy consumption in its data centers. The AI started off making random adjustments to cooling and power use. Each time the energy efficiency improved, it was rewarded, and over time, it learned what settings kept servers cool while using the least energy, all through trial and error. In the end, it cut energy usage by 40%, just by continuously improving its own decisions.

Reinforcement learning is perfect when AI needs to make decisions that continuously improve, whether in real-time or through long-term optimization.

Outside of these three main types, there are a few specialized techniques that help AI learn even faster. These methods don’t replace Supervised, Unsupervised, or Reinforcement learning, but they do make AI even smarter.

Read more: Why AI won’t replace developers

Other Machine Learning techniques

  • Semi-supervised learning: This is a mix of supervised & unsupervised learning. AI gets some labeled data and figures out the rest on its own. For example if AI scans thousands of medical images, but only a few are labeled with diseases. Instead of waiting for them to be labeled it starts labeling the rest, by making educated guesses based on the patterns it learned.
  • Self-supervised learning: This is when AI teaches itself by labeling its own data. Take handwriting recognition, for example. Instead of a person labeling every single digit, AI removes parts of the numbers and tries to guess the missing pieces. The more it practices, the better it gets at filling in the blanks, until eventually, it can read even the messiest handwriting. Kind of like how we can still recognize words in a sentence even if some letters are missing or spelled incorrectly.
  • Transfer learning: This is when AI doesn’t have to learn from scratch. It can take what it’s already learned from one task and apply it to something new. For example, say an AI has been trained to recognize cats. It already knows how to detect fur, ears, eyes, all that, so when we train it to recognize dogs, it doesn’t need nearly as much new data. It just tweaks what it already knows, like, “Oh, these animals are similar, but dogs have different shaped ears, etc.” So instead of learning everything from ground zero, it speeds through the process. It’s kind of like switching from learning Spanish to Italian. You’re not necessarily starting over, you’re just adjusting what you already know.

AI learns from data, but what happens when it learns the wrong thing?

I know this was a lot of information, and hopefully, I didn’t lose you, but before you run off, there’s one more thing we really need to talk about, why the quality of AI’s training data matters just as much as the quantity.

The more data AI sees, the smarter it gets. This is what makes ML so powerful, it doesn’t rely on a fixed set of rules, it just keeps learning.

  • That’s why AI keeps getting better at translating languages
  • That’s why your phone’s autocorrect improves over time
  • That’s why self driving cars are getting safer every year

But here’s the thing, AI is only as good as the data it learns from.

If AI is trained on biased or incomplete data, it can make unfair or inaccurate decisions. Imagine a facial recognition system that struggles to identify certain skin tones because it was trained mostly on lighter skin tones. Or a hiring algorithm that favors certain resumes simply because its training data was based on biased hiring trends.

This is why diverse, high quality data matters. The more inclusive the training data, the less biased and more accurate AI can become, but fairness in AI also depends on how the data is used.

So while more data = better predictions, the right data = better AI for everyone.

🤖 Ctrl + AI + Del — Resetting the way we think about AI

More on deep learning in a subsequent article in this series. Missed the first lesson? We covered What is AI? Catch up now.

More from We Love Open Source

This article is adapted from “What is ML?” by Ebony Louis, and is republished with permission from the author.

About the Author

Developer Advocate @ Block | Open Source | Artificial Intelligence

Read Ebony Louis's Full Bio

The opinions expressed on this website are those of each author, not of the author's employer or All Things Open/We Love Open Source.

Want to contribute your open source content?

Contribute to We ❤️ Open Source

Help educate our community by contributing a blog post, tutorial, or how-to.

This year we're hosting two world-class events!

Check out the AllThingsOpen.ai summary and join us for All Things Open 2025, October 12-14.

Open Source Meetups

We host some of the most active open source meetups in the U.S. Get more info and RSVP to an upcoming event.

OSZAR »