ML 101
M01 · L03
Introduction

Your First ML Model

You know what ML is and its three types. Now let’s build your first mental model of how machines actually learn — from data to predictions.

01 / 13
ML 101
M01 · L03
The basics

What is a Model?

A function that takes inputs and produces outputs. In traditional programming, humans write the rules. In ML, the model discovers the rules from data.

Think of it as
A black box with adjustable knobs. Training tunes the knobs until predictions become accurate.
02 / 13
ML 101
M01 · L03
Ingredients

Features & Labels

Features (X) are inputs the model uses. Labels (y) are answers it predicts. Feature quality often matters more than algorithm choice.

Features (X)
Inputs
Labels (y)
Answers
03 / 13
ML 101
M01 · L03
Data

Training Data

A model learns from examples where we already know the answers. More examples, more representative → better model. Bad data = bad model.

The analogy
Like studying for an exam: more practice problems covering more topics leads to better performance on the real test.
04 / 13
ML 101
M01 · L03
The loop

Predict → Compare → Adjust

The fundamental mechanism behind all supervised learning:

Predict — use current parameters to make predictions
Compare — measure how wrong using a loss function
Adjust — tweak parameters to reduce the error
Repeat — thousands or millions of iterations
05 / 13
ML 101
M01 · L03
Measurement

Loss Functions

The model’s report card. Mean Squared Error squares prediction errors and averages them — penalizing large mistakes heavily.

Mean Squared Error
\text{MSE}=\frac{1}{n}\sum_{i=1}^{n}(\hat{y}_i - y_i)^2
06 / 13
ML 101
M01 · L03
Optimization

Gradient Descent

Imagine standing on a hill in fog. You can’t see the bottom, but you feel the slope. Take a step downhill. Repeat. That’s gradient descent.

Update Rule
w \leftarrow w - \alpha \frac{\partial \mathcal{L}}{\partial w}
07 / 13
ML 101
M01 · L03
Simplest model

Linear Regression

The simplest ML model: a straight line. w is the weight (slope), b is the bias (intercept). Despite its simplicity, it’s powerful and widely used.

Linear Model
\hat{y} = wx + b
08 / 13
ML 101
M01 · L03
The tension

Overfitting vs Underfitting

The central challenge of ML:

Overfitting
Memorizes noise
Underfitting
Misses patterns
09 / 13
ML 101
M01 · L03
Evaluation

Train / Test Split

Hold out data the model never sees during training. Evaluate on it. If training accuracy is high but test accuracy is low — overfitting detected.

Training
80%
Testing
20%
10 / 13
ML 101
M01 · L03
Workflow

The Full ML Pipeline

Five steps, always iterative:

1. Collect — gather and prepare data
2. Split — training set + test set
3. Train — fit model on training data
4. Evaluate — measure on test data
11 / 13
ML 101
Knowledge Check

Check what stuck

Three questions from this lesson. Answer to see why — the explanation appears whether you were right or wrong. Nothing is scored or saved.

Question 1 of 0
Score 0/0

12 / 13
ML 101
Summary
Recap

What you learned

A model learns from data through predict → measure → adjust loops. Loss functions guide learning. Gradient descent finds the minimum. Train/test splits catch overfitting.

Next Lesson
13 / 13