Zero to AI Engineer

Module 3 of 54

Module 3: Machine Learning Basics

5 min read867 words
What you'll learn
Explain how machine learning differs from normal programmingName the three main types of MLDefine features, labels, training, and predictionFollow the basic ML workflow

"Instead of programming the answer, you show the computer examples and let it work out the pattern. That flip is machine learning."

Level: Beginner · Time: ~13 min · Prerequisites: Modules 1–2

Learning Objectives

By the end of this module, you will be able to:

  • Explain how machine learning differs from normal programming
  • Name the three main types of ML
  • Define features, labels, training, and prediction
  • Follow the basic ML workflow

1. The Big Flip

In traditional programming, a human writes the rules: Rules + Data → Answers. In machine learning, we flip it: Data + Answers → Rules. You feed the computer examples (data) along with the correct answers, and it learns the rules — a bundle we call a model.

A sketchnote overview of AI and machine learning concepts
A sketchnote overview of AI and machine learning concepts

Once trained, the model takes new data and predicts an answer. The subtle magic is that nobody ever tells the model the rule directly — it discovers one that fits the examples. Show it a thousand houses with their sizes and prices, and it works out roughly "price rises with size" on its own, then applies that to a house it has never seen.

Explain like I'm new: Teaching a child "cat" by pointing at many cats — never by listing rules like "four legs, whiskers" — is machine learning. After enough examples, they recognize a cat they've never seen. The model does the same.

2. Three Types of Machine Learning

TypeYou give it…It learns to…Example
SupervisedExamples with answers (labels)Predict the answerSpam / not spam
UnsupervisedExamples without answersFind hidden groupsCustomer segments
ReinforcementAn environment + rewardsAct to maximize rewardGame-playing agents

Supervised learning is the most common starting point, and it splits into regression (predict a number) and classification (predict a category). "How much will this house sell for?" is regression — the answer is a number on a scale. "Is this email spam or not?" is classification — the answer is one of a few fixed buckets. Spotting which of the two you're facing is often the first decision in a real project.

Key idea: The type of ML you use depends on your data. Have labeled answers? Supervised. Just raw data to explore? Unsupervised. A goal to achieve through trial and error? Reinforcement.

3. The Vocabulary: Features & Labels

  • Features (X): the input clues — a house's size, rooms, location.
  • Label (y): the answer to predict — the house's price.
  • Training: the model studies many (features → label) examples.
  • Prediction (inference): the trained model estimates the label for new features.

Real-world use case: A bank predicts loan default risk. Features = income, credit history, loan amount; label = "defaulted: yes/no" from past loans. The model learns the pattern and scores new applicants — a supervised classification task running millions of times a day.

4. The ML Workflow

Every ML project follows the same rhythm:

  1. Ask a clear question
  2. Gather & clean data (usually the biggest job)
  3. Split into training and testing sets
  4. Choose & train a model
  5. Evaluate on unseen test data
  6. Tune and repeat
  7. Deploy and predict

A golden rule: always test on data the model hasn't seen, or you're just checking its memory, not its learning.

Concept: Step 2 — gather and clean data — sounds boring but routinely eats 60–80% of a real project's time. Data arrives with typos, missing values, and duplicates. The saying "garbage in, garbage out" is brutally true here: no clever model rescues bad data. Beginners underestimate this step; professionals plan for it.

Hands-On: Try This

Try this: Pick a prediction from your life — will it rain tomorrow? will this email get a reply? Write down the features you'd use and the label you'd predict. You've just framed a machine learning problem the way a practitioner does.

Common Mistakes

Common mistake: Testing a model on the same data it trained on. It'll look brilliant and then fail in the real world — like a student who memorized the practice answers. Always keep a separate, unseen test set.

✅ Checkpoint

  1. In one line, how does ML differ from traditional programming?
  2. Which ML type uses labeled data?
  3. What are features and labels?

Answers: 1) Traditional = rules + data → answers; ML = data + answers → rules. 2) Supervised. 3) Features are the inputs (X); the label is the answer to predict (y).

Key Takeaway: Machine learning flips programming: show data + answers, and the model learns the rules. It comes in supervised (labeled), unsupervised (unlabeled), and reinforcement (reward-driven) flavors. You learn from features (X) to predict a label (y), always testing on unseen data — following the workflow of ask → gather → split → train → evaluate → tune → deploy.

Further Learning

Adapted from Microsoft's AI for Beginners (MIT License). Sketchnote by Tomomi Imura.