Skip to main content

Machine Learning: Foundations & Models

Source: Unit 1 §1

What machine learning is

In our world we have humans and computers. Humans learn from experience; computers traditionally follow instructions. The question that starts the subject is whether a computer can learn from experience too, and the answer is yes, provided you accept that a computer's word for "experience" is data.

HUMANSlearn fromEXPERIENCECOMPUTERSlearn fromDATAthis is ML
The whole premise of ML in one line: swap "experience" for "data" and the learner can be a machine.

The two broad phases

DATATRAININGbuild and fine-tunethe predictive modelmodelPREDICTIONserve results onpreviously unseen dataanswer toa query
Training builds the model from data; prediction serves it on data the model has never seen.
PhaseWhat happens
TrainingUse data to create and fine-tune a predictive model.
PredictionUse the trained model to serve predictions on previously unseen data and answer queries.

The seven steps to machine learning

StepsThe ML pipeline, in order
  1. Gathering data - collect raw data.
  2. Data preparation - clean, format, split.
  3. Choosing a model - pick an algorithm.
  4. Training - fit the model to the data.
  5. Evaluation - test on unseen data.
  6. Parameter tuning - improve performance.
  7. Prediction - deploy and answer queries.
Exam cueMemory hook

Gather → Prepare → Choose → Train → Evaluate → Tune → Predict.

Formal definitions

Herbert Simon: "Learning is any process by which a system improves performance from experience."

Tom Mitchell (1998): Machine Learning is the study of algorithms that improve their performance P at some task T with experience E. A well-defined learning task is given by the triple ⟨P, T, E⟩.

FactsCheckers, as a ⟨T, P, E⟩ triple
  • T (task) - playing checkers.
  • P (performance measure) - percentage of games won.
  • E (experience) - playing practice games against itself.
GotchaA task is not well defined until all three are named

"Learn to play checkers" is not a learning task, because Mitchell's definition is a triple. Without P you cannot tell whether learning happened, and without E you have not said what the learner is allowed to see.

When machine learning is the right tool

FactsFour situations that call for learning
  • Human expertise does not exist - navigating on Mars.
  • Humans cannot explain their expertise - speech recognition.
  • Models must be customised - personalised medicine.
  • Models are based on huge amounts of data - genomics.

The classic hard task is recognising a handwritten 2. Writing down the rules for what makes a 2 a 2 is very hard; learning it from examples is easy. That gap is the whole argument for the field.

Category of taskExamples
Recognising patternsfacial identities and expressions, handwritten or spoken words, medical images
Generating patternsgenerating images or motion sequences
Predictionfuture stock prices, currency exchange rates

The three broad categories

MACHINE LEARNINGSUPERVISED(inductive)data + labelslearn input → outputUNSUPERVISEDlearningdata, no labelsfind hidden structureREINFORCEMENTlearningrewards from actionslearn a policy
The three broad categories, separated by what the training signal is: labels, nothing, or rewards.
TypeGivenGoal
Supervised (inductive)training data + desired outputs (labels)learn a mapping input → output
Unsupervisedtraining data without labelsfind hidden structure, e.g. clustering
Reinforcementrewards from a sequence of actionslearn a policy, state → action

Supervised learning

Given pairs (x1,y1),(x2,y2),,(xn,yn)(x_1,y_1), (x_2,y_2), \ldots, (x_n,y_n), learn a function f(x)f(x) that predicts yy from xx. The type of yy splits the family in two.

CompareRegression vs classification
Regressiony is real-valued (continuous). Predict the price of a house.
Classificationy is categorical (discrete). Decide spam or not-spam.

Unsupervised learning

Given x1,x2,,xnx_1, x_2, \ldots, x_n without labels, output the hidden structure behind the xx's. The canonical instance is clustering: in genomics, group individuals by genetic similarity when nobody has told you which groups exist.

Reinforcement learning

Given a sequence of states and actions with (possibly delayed) rewards, output a policy - a mapping from states to actions that tells the agent what to do in each state.

AGENTENVIRONMENTaction aₜstate sₜ₊₁, reward rₜ₊₁observes sₜ ∈ S, picks aₜ ∈ A(sₜ)t = 0, 1, 2, … discrete steps
The RL loop at discrete time steps: the agent acts, the environment answers with a new state and a (possibly delayed) reward.

Designing a learning system

StepsFour design choices
  1. Choose the training experience - what data, and how it is gathered.
  2. Choose exactly what is to be learned - the target function.
  3. Choose how to represent the target function.
  4. Choose a learning algorithm to infer the target function from the experience.

The OSI analogy for the ML pipeline

The slides map the ML pipeline onto the seven-layer OSI stack to show it as a layered flow, with raw data at the bottom and decisions at the top.

OSI layerML pipeline stageLevel
ApplicationApplication / decision makinghigh
PresentationDecision making
SessionClassification
TransportFeature extraction
NetworkSegmentation
Data linkProcessing
PhysicalRaw input datalow

Takeaway: ML transforms raw input data → segmentation → feature extraction → classification → decision, layer by layer.