Regression and AI in practice
| English | Chinese | Pinyin |
|---|---|---|
| regression | 回归 | huí guī |
| classification | 分类 | fēn lèi |
| linear regression | 线性回归 | xiàn xìng huí guī |
| OCR | 光学字符识别 | guāng xué zì fú shí bié |
| inference | 推理 | tuī lǐ |
Learning from data
- Some AI tasks predict a number rather than a category — that's regression 回归.
- Both are supervised learning.
- Real systems combine trained models into a pipeline.
Regression vs classification 分类
- Classification predicts a category (cat/dog, spam/not-spam).
- Regression predicts a number (a house price, tomorrow's temperature).
- Both are supervised; the choice depends on whether the answer is a number or a label.
The difference between regression and classification is that regression predicts:
Regression outputs a continuous number (price, temperature); classification outputs a category.
Regression predicts a continuous number (a price, a temperature), while classification predicts a category (cat vs dog).
Number out = regression; category out = classification — the two main kinds of supervised prediction.
Linear regression 线性回归
- Linear regression fits a straight line (or hyperplane):
- The coefficients are chosen to minimise the sum of squared errors against the training data.
- Use it when the relationship looks roughly linear and you want an interpretable model; curved data needs polynomial, tree or neural-network regression — same idea (model + loss + minimise).

Linear regression fits the straight line that minimises the total squared distance to the data points

Training adjusts the weights to reach the minimum error
Fitting a regression line
Drag the controls. Linear regression draws the straight line that makes the squared distances to the data points as small as possible — then it predicts a number for any new input.
Linear regression chooses its coefficients to:
It fits the line/hyperplane that makes the squared differences from the data points as small as possible.
AI in a real scenario
- Most scenarios use a deep model trained on labelled data, often several combined:
- Face identification: trained on labelled faces → a camera captures a face → image recognition extracts a representation → match against registered customers.
- Reading a label aloud: image recognition finds text → OCR 光学字符识别 extracts characters → machine translation → text-to-speech.
- By the time a user interacts, the model only does fast forward-pass inference 推理 — the intelligence is in the learned patterns.
Match each AI idea to what it means.
Training fits the model once; inference is the quick prediction each time a user interacts.
A "read a sign aloud" feature typically chains which models?
Several trained models form a pipeline: find the text, extract characters, translate, then speak.
You've got it
- classification predicts a category; regression predicts a number (both supervised)
- linear regression fits a line by minimising the sum of squared errors
- real systems chain trained models into a pipeline (e.g. image recognition → OCR → translation → TTS)
- using a trained model is just a fast forward pass (inference)