Machine Learning Techniques · IIT Madras BS Degree

Introduction and the paradigms of machine learning

Notes for lectures 1 and 2. What machine learning is and is not, the three paradigms and their sub-types, and why linear algebra, probability and optimization keep coming up.

Part 1 of 18 Instructor Prof. Arun Rajkumar About 50 min of video

At a glance

  • Machine learning means learning from data so that you do well on data you have not seen. That property is called generalization.
  • It is not a hand-written procedure, not memorization and not magic. It is algorithms plus data, built on mathematics.
  • The three paradigms differ in what the learner is given: labelled data (supervised), unlabelled data (unsupervised), or feedback one decision at a time (sequential).
  • The course covers classification, regression, clustering and representation learning. Ranking, structured learning and all of sequential learning are only mentioned.
  • Every algorithm needs a structure (linear algebra), a way to handle noise (probability) and a way to pick the best answer (optimization).
L1 · 1:02

Why study machine learning

The first reason is reach. A Forbes list of the top ten digital transformation trends, from a couple of years before the lecture, included analytics, AI and machine learning, conversational AI and autonomous drones. Each of these depends on machine learning in one way or another.

The second is popularity. On Google Trends, searches for machine learning, deep learning and artificial intelligence all took off from about 2016. "Artificial intelligence" was the common search in the early 2000s, faded as machine learning took over, and has recently picked up again with newer ideas such as causality.

Deep learning is a subset of machine learning. The BS programme covers it in a separate elective.

L1 · 3:42

Where machine learning is used

One way to find applications: list what comes naturally to people, then ask how a machine could do the same.

Seeing → computer vision

The eye and brain evolved over millions of years. Getting a computer to say "this picture contains a tree" is object recognition.

Hearing speech → language understanding

Speech is unstructured. Different people say the same thing in different ways, and we still understand them.

Reading → text understanding

Millions of unstructured documents appear every day. Tasks range from understanding meaning to reading handwriting.

Thinking → how the brain learns

The holy grail: understanding, computationally, how interconnected neurons learn and decide. Progress comes in small steps.

Beyond the senses, anything that produces a lot of data can be learned from:

  • Finance. Will a stock go up, given how it has done over time?
  • Science and engineering. Biology, chemistry and materials experiments.
  • Sports analytics. Who wins the next IPL match, Chennai or Bangalore? (The lecturer is a Chennai fan.)
  • E-commerce. "People similar to you bought this", picked to maximize the chance you buy it.

Rule of thumb: wherever there is a lot of data, there is probably a machine learning problem.

What machine learning is, and what it is not

The lecture defines ML by contrast. Each misconception has a matching answer.

It is notIt isLecture example
A procedure. Input runs through fixed steps to an output, and nothing is learnt. Algorithms plus data. Data is the "secret sauce": the algorithm learns from it, then predicts on test data. A tax calculator applies fixed rules to your salary and savings. No learning happens.
Memorization. Generalization. Doing well on unseen data, which only works if the concept was actually learnt. 1,000 photos with trees and 1,000 without. Memorizing all 2,000 answers tells you nothing about a new photo.
Magic. Mathematics. The prerequisites (below) are the maths behind every algorithm.
Procedural program · tax calculator Input salary, savings Rules written by a person Output tax to pay fed to returns Machine learning · training Data inputs + known answers Learning algorithm searches for rules Model learned rules fed to produces same model, reused Machine learning · use New input an email never seen Model learned rules Prediction spam or not spam fed to returns
Procedure vs learning. In a procedural program a person writes the rules. In machine learning the rules (the model) come out of data, and the model is judged on inputs it never saw during training.

The lecture's exam analogy makes the second row concrete. If the final exam only repeated the assignment problems, memorizing every step would score full marks without learning the subject. ML is always graded on the unseen exam.

Memorizer stores the 16 labelled photos ? New photo: no stored match, so no answer Learner finds a rule that separates them tree side no-tree side learned boundary New photo: lands on the tree side, so "tree" photo with a tree photo without a tree new photo, never seen in training
Memorization vs generalization. Each photo is drawn as a point described by two features. Both learners get the same 16 labelled photos. Only the one that learnt a rule can answer for a photo outside that set.

L1 closes with eight example problems: spam filtering, rainfall forecasting, movie recommendations, friend suggestions, voice/instrument separation, photo grouping, robot navigation and stock prediction. L2 sorts them into paradigms; they are collected in one table below.

L2 · 0:13

Three paradigms

The paradigms are told apart by what the learner is given.

  • Supervised learning. Data plus supervision. A teacher or labeler marks emails as spam or not spam, and the job is to learn to tell the labels apart.
  • Unsupervised learning. Only data. You are asked to make sense of it, for example by grouping it automatically.
  • Sequential learning. You do not learn in one shot. You make a decision, receive feedback (a form of supervision), update your model, and repeat. This is not covered in the course.
Supervised given: data and labels x y email 1 spam email 2 not spam email 3 spam Learns the map x → y then predicts y for a new email Unsupervised given: data only group A group B Finds structure itself groups, or a better representation Sequential given: feedback after each step predict feedback update repeat Learns while acting not covered in this course
What each paradigm starts with. Supervised learning gets the answers (labels) up front. Unsupervised learning gets none and must find structure. Sequential learning gets its supervision piece by piece, after each decision it makes.

Unsupervised problems need a notion of similarity

Hand someone a pile of animal photos with no labels and the task is not yet well posed. The photos could be grouped as animal vs background, dogs vs cats, four animals vs six, or white vs brown fur. Each is a different notion of similarity. Fix one, say cats vs dogs, and the groups follow: only cats, only dogs, and both.

The sub-types L2 · 4:16

covered in this course mentioned only Machine learning Supervised Unsupervised Sequential Classification · a finite set of labels Regression · a continuous output Ranking · put items in the right order Structured learning · labels with structure Clustering · group similar points Representation learning · better features Online learning · full feedback Multi-armed bandits · partial feedback Reinforcement learning · learn a policy
The paradigms and their sub-types. Solid boxes are taught in this course. Dashed boxes are named in L2 so you know they exist.
  • Classification: labels come from a finite set. Spam vs non-spam is binary (2 labels). Recognizing the digits 0–9 has 10 labels: still finite, just not binary.
  • Regression: the output is a continuous number.
  • Ranking: order a set of objects instead of predicting one label each.
  • Structured learning: the labels themselves have structure, for example trees.
  • Clustering: grouping objects, as in the animal photos.
  • Representation learning: how to represent each data point so a task becomes easier. An image stored as raw pixel values may not be the best form for spotting a tree. It can be done with or without supervision; this course does the unsupervised kind, starting in L3.
L2 · 6:41

Sequential learning, briefly

Not examined in this course, but worth knowing. The three settings differ in how much feedback each decision returns.

  • Online learning (full information). You take stock advice from a group of experts and decide whether to invest. In the evening you see whether the stock went up. That outcome scores every expert's advice, not just your decision.
  • Multi-armed bandits (partial feedback). An algorithm suggests one of four treatments for a patient. A week later you know whether that patient improved, but not what the other three treatments would have done. You see less, so the problem is harder.
  • Reinforcement learning. A robot must cross a room with obstacles. At each location (the state) it picks front, left, right or back (the action). The mapping from states to actions is a policy, learned from the environment's feedback by trial and error. Moving forward is not always wrong; it depends on where the robot is.
Online learning full information · 4 experts advise on a stock your pick E1invest E2skip E3invest E4skip Stock fell: every expert's advice is scored you learn about all 4 options at once Multi-armed bandit partial feedback · 4 possible treatments your pick T1not given T2given T3not given T4not given ? ? ? Patient improved: only T2 is scored the other 3 outcomes stay unknown
Full vs partial feedback. Count the badges. One day of the stock market grades all four experts. One patient's recovery grades only the treatment that was given.
Robot (agent) policy π : state → action Room (environment) walls, obstacles, the far end action: front, left, right or back new state (location) + feedback, e.g. hit a wall
Reinforcement learning. Nobody hands the robot a map. It improves its policy only from what each action leads to.

Eight problems, sorted by paradigm

L1 lists these problems and L2 places each one. Hide the answers and try to classify them first.

ProblemWhat you haveParadigm
1Spam filterEmails already labelled spam or not spam Supervised · binary classificationtwo possible labels
2Rainfall forecast10–15 years of daily pressure, humidity, precipitation and rainfall Supervised · regressionrain is a continuous amount, like 2.23 cm
3Movie recommendationsWhat you have watched; about five slots on the home screen Ranking / ordinal classificationorder matters: the right film in 100th place is useless
4Friend suggestionsA network of people and their existing connections Link predictionwill a missing edge in the network form?
5Voice / instrument separationSongs (MP3s) where the voice and instruments overlap Unsupervisedlabelling every second is tedious, and often both play at once
6Grouping photos on a phoneUntagged photos from different angles, places and times of day Unsupervised · clusteringit knows the faces match, not whose they are
7Robot navigationFeedback after every move it makes Sequential · reinforcement learninglearns a policy by trial and error
8Stock predictionPredict each morning, see the result each evening, for you and your advisers Sequential · online learningfull feedback on every adviser, every day
? A B C D E F nodes = people · edges = friendships
Friend suggestion as link prediction. A and E are not connected yet but share two friends, B and F, so A–E is a likely edge to suggest. Shared friends are only one simple signal; the lecture does not fix a method.

The prerequisites are those of the ML Foundations course: linear algebra, probability, statistics, high-school calculus and a little optimization. The lectures try to stay self-contained, so knowing that material is enough even without MLF.

The example: record the weight and height of 100 people and plot them. Can you predict someone's height from their weight alone? On average height rises with weight, roughly in a straight line, so look for the best line. But there are infinitely many lines, even if you only allow lines through the origin, and none of the points sit exactly on the best one. You need a criterion for "best". Try it:

1.25 cm/kg
Your mean squared error–
Lowest possible–
Synthetic data for 100 people, generated for this page to match the shape of the lecture's plot. Every candidate line pivots on the average person (yellow dot), because the best line always passes through it. The thin grey segments are each person's error. "Best" here means the smallest mean squared error, one common criterion; the regression lectures (L28 onward) treat it properly. Hover a dot to see one person.

Three ingredients, three subjects L2 · 21:37

Structure

Linear algebra

Assume weight and height are linearly related, so search over lines. Linear structure comes first; non-linear structure is built on it later in the course.

Uncertainty

Probability

Points miss the line because of noise: how the data was collected, faulty equipment, missing values. Probability is the language for that uncertainty.

Decisions

Optimization

Pick the line that does best by some measure, which means maximizing or minimizing something. That is how data becomes a decision.

L2 · 15:52

What the course aims for

  • A clear high-level picture of the paradigms, then the detail through specific algorithms.
  • Given a real-world problem, pose it as an ML problem (supervised? unsupervised?) and choose algorithms that suit it.
  • Know the key algorithms: how they differ, when and why each works, and their pros and cons.
  • A solid theoretical and statistical base, so algorithms are understood from the inside rather than as black boxes.
  • Implement the algorithms from scratch and show results with graphs and plots. Non-graded assignments and the discussion forum are there for this.
L2 · 22:42

Roadmap and references

The course starts with unsupervised learning, then moves to supervised learning, with assignments along the way to check where you stand.

Unsupervised Supervised You are here (L1–L2) Finish RepresentationlearningL3–L12 ClusteringL13–L18 EstimationL19–L26 BasicalgorithmsL27–L44 AdvancedalgorithmsL45–L65 AdvancedtopicsL66–L74
The course in six levels. The level names are the lecturer's. The lecture ranges are mapped from the playlist titles for these notes.

References L2 · 24:18

No single textbook is followed. The lecture notes are enough for assignments and exams; these are for going deeper.

  • Pattern Recognition and Machine Learning (PRML)Christopher M. BishopThe main reference. Notation and order differ from the lectures, but every topic taught has a matching section, and the book covers a superset. One edition is freely available.
  • Mathematics for Machine LearningDeisenroth, Faisal and OngPuts the foundations maths into an ML context. Free from the authors.
  • Linear Algebra and Its ApplicationsGilbert StrangFor brushing up linear algebra.
  • A First Course in ProbabilitySheldon RossFor probability.

Key terms

Generalization
Doing well on data the algorithm has never seen. The goal of ML, as opposed to memorization.
Supervised learning
Learning from data that comes with labels supplied by a teacher or labeler.
Unsupervised learning
Finding structure (groups, representations) in data without labels.
Sequential learning
Learning step by step from feedback on your own decisions.
Classification
Predicting a label from a finite set. Binary when there are two labels.
Regression
Predicting a continuous number.
Representation learning
Finding a better description of each data point so a task becomes easier.
Full-information feedback
After each round you learn how every option would have done (online learning).
Partial feedback
You learn the result only for the option you chose (multi-armed bandits).
Policy
A mapping from states to actions, learned in reinforcement learning.
Link prediction
Predicting which missing edges in a network are likely to exist.
Ordinal classification
Predicting items and also the order they should appear in, as in recommendations.

Test yourself

Q1A spam filter and a rainfall forecaster are both supervised. What separates them?

The type of label. Spam or not spam is a finite set, so it is binary classification. Rainfall in centimetres is continuous, so it is regression.

Q2Why doesn't memorizing the training data count as learning?

It can only answer for inputs it has already seen. ML is judged on unseen data, and doing well there (generalization) requires learning the underlying concept.

Q3Your phone groups photos by person but asks you to type the names. Which paradigm is this, and why does it have to ask?

Unsupervised clustering. It was given no labels, so it can tell that faces are similar to each other but not who they belong to.

Q4Why is choosing a treatment "partial feedback" while following stock experts is "full information"?

With treatments you only observe the outcome of the one you gave. With experts, the day's market move scores every expert's advice, including the ones you ignored.

Q5In the height–weight example, which subject handles each step: assuming a line, points that miss the line, choosing the best line?

Linear algebra (structure), probability (uncertainty), optimization (decision).

Q6Movie recommendation is more than predicting "will they like it". What extra requirement makes it a ranking problem?

Order. There are only about five slots on screen, so the right movies must appear in the right order. A good movie found but placed 100th is not useful.