What is Machine Learning?
What ML really is, the three types, and how it differs from normal programming.
The technology reshaping the world
Machine learning (ML) is the engine behind much of modern technology: the recommendations on Netflix and YouTube, spam filters, fraud detection on your bank account, face recognition, medical diagnosis tools, and self-driving cars. It's one of the most valuable and sought-after skills in all of tech. And the good news? You can learn to build real ML models with the Python skills you already have, without needing a PhD or heavy mathematics. This course shows you how, practically and hands-on.
So what is machine learning? Here's the cleanest definition: machine learning is teaching computers to learn patterns from data, rather than programming every rule by hand. That shift — from writing rules to learning from examples — is the whole idea, and it's a genuinely different way of building software.
The key difference from normal programming
Understanding this distinction is the foundation of everything. In traditional programming, you write the rules and the computer follows them: you provide the logic. In machine learning, you provide examples (data) and the computer figures out the rules itself:
# Traditional programming: YOU write the rule
def is_spam(email):
if "win money" in email or "free prize" in email:
return True
return False
# Problem: you can never list every possible spam phrase
# Machine learning: the computer LEARNS the rule from examples
# You show it thousands of emails labelled "spam" or "not spam",
# and it discovers the patterns of spam on its own.
The spam example shows why ML matters. You could never write rules covering every spam trick — spammers constantly change tactics. But feed a model thousands of labelled examples, and it learns the subtle patterns, even ones you'd never think to code. This is why ML excels at problems too complex for hand-written rules: recognising faces, understanding speech, predicting behaviour.
The three types of machine learning
ML comes in three main flavours, and knowing which is which orients you for the whole field:
- Supervised learning — you give the model examples with the right answers (labelled data), and it learns to predict those answers for new cases. This is by far the most common, and the focus of most of this course. Examples: predicting house prices, classifying emails as spam.
- Unsupervised learning — you give the model data without answers, and it finds hidden structure on its own, like grouping similar customers. Examples: customer segmentation, anomaly detection.
- Reinforcement learning — the model learns by trial and error, getting rewards for good actions. Examples: game-playing AI, robotics.
We'll spend most of our time on supervised learning, because it's the most widely used and the best place to start. Within it, there are two sub-types we'll explore: regression (predicting a number, like a price) and classification (predicting a category, like spam/not-spam).
The tools: Python and scikit-learn
Just as pandas powers data science, one library dominates beginner-to-intermediate machine learning: scikit-learn. It provides ready-made implementations of all the major ML algorithms with a beautifully consistent, simple interface. You don't implement the complex maths — you use well-tested tools and focus on applying them well:
# scikit-learn's consistent pattern (you'll use this constantly):
from sklearn.linear_model import LinearRegression
model = LinearRegression() # 1. create a model
model.fit(X_train, y_train) # 2. train it on data
predictions = model.predict(X_new) # 3. make predictions
Notice the elegant three-step pattern: create, fit, predict. Almost every model in scikit-learn — whether simple or sophisticated — follows this exact pattern. Learn it once, and you can use dozens of algorithms. This consistency is what makes scikit-learn so beginner-friendly and so widely used in industry.
What you'll be able to do
By the end of this course, you'll understand how machines learn, and you'll have built real models that predict numbers and classify things, evaluated them properly, and run a complete ML project from data to predictions. The data science skills from our previous course (pandas, NumPy, cleaning data) are the perfect foundation — ML takes that clean, prepared data and learns from it. Let's start by understanding exactly how a machine learns from data, which is the topic of the next chapter.
Finished "What is Machine Learning?"?
Mark this chapter complete so you can pick up exactly where you left off. Your progress saves locally — sign in to sync across devices.
Was this chapter clear?
