02_intro_learning
02_intro_learning
apple apple
pear pear
tomato
tomato
cow
cow
dog
dog
horse
horse
Testing Learned
Features Prediction
Model
time
Test Sample
Credit: Lazebnik
Basic Supervised Learning Formulation
y = f(x)
output prediction input
function
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f using training data
• such that f is correct on test data
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f using training data What kind of functions are allowed?
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f ∈ 𝓗 using training data Hypothesis space of f
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f ∈ 𝓗 using training data Is there any connection between
training and test data?
• such that f is correct on test data
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f ∈ 𝓗 using training data i.i.d. samples from the same
distribution D
• such that f is correct on test data
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f ∈ 𝓗 using training data
• such that f is correct on test data How do we measure correctness?
y = f(x)
output prediction input
function
Formulation:
• Given training data: {(x1,y1), …, (xN,yN)},
• Find f ∈ 𝓗 using training data
• such that f is correct on test data Loss measures in next class
Training
Training examples
examples from class 2
from class 1
Credit: Lazebnik
Simple Classifier
Training
Training Test
examples
examples example
from class 2
from class 1
f(x) = ?
Credit: Lazebnik
Nearest Neighbor Classifier
Training
Training Test
examples
examples example
from class 2
from class 1
k=3
k=3
Training
Training examples
examples from class 2
from class 1
Credit: Lazebnik
Linear Classifier
Training
Training examples
examples from class 2
from class 1
Credit: Lazebnik
Linear Classifier
Class 1 Class 2
Test
example
Credit: Lazebnik
Linear Classifier
Class 1 Class 2
Test
example
Credit: Lazebnik
Quick review
Linear Classifier
Class 1 Class 2
Test
example
Credit: Lazebnik
Linear Classifier for >2 classes
Earthquakes
Surface wave magnitude
Nuclear explosions
Credit: Lazebnik
Linear Classifier: Perceptron view
Input
Weights
x1
w1
x2
w2
Output: sgn(wTx + b)
x3
w3
.
.
.
wD
xD
Credit: Lazebnik
Loose inspiration: Human neurons
Credit: Lazebnik
kNN vs. Linear Classifiers
kNN Pros Linear Pros
+ Simple to implement + Low-dimensional parametric representation
+ Decision boundaries not necessarily linear + Easy to learn (more later)
+ Works for any number of classes + Very fast at test time
+ Nonparametric method
kNN Cons Linear Cons
– Need good distance function – Works for two classes (?)
– Slow at test time – How to train the linear function?
– What if data is not linearly separable?
Credit: Lazebnik
Prediction Scenarios
• Supervised Learning
• Given: Inputs (data-label pairs)
• Later classes: other prediction scenarios
Learning Paradigms
Supervised Learning
• Given inputs (data-label pairs), learn a model to predict output
Credit: Lazebnik
Unsupervised Learning: Clustering
• Discover groups of “similar” data points
Credit: Lazebnik
Unsupervised Learning: Quantization
Quantization or data compression
• Encode the data into a more compact form
C2
C1
C3
Credit: Lazebnik
Unsupervised Learning: Dimensionality Reduction
Dimensionality reduction, manifold learning
• Discover a lower-dimensional surface on which the data lives
Supervised Unsupervised
Learning Learning
Use ML to assign
images concepts
Vocabulary: Person, Cat, Dog, Horse, Sheep, Cow person sheep dog
Labels: Person, Sheep, Dog
Vocabulary: Person, Cat, Dog, Horse, Sheep, Cow person sheep dog grass
Labels: Person, Sheep, Dog, Grass
• Needs nice, clean labels • Noisy, often incorrect, labels • Needs nice, clean labels • No labels
• All data needs to be labeled • All data needs to be labeled • Small portion of data needs • No labels
• Labels correspond to task of • Labels might not correspond to be labeled • How does this work?
interest to task of interest, but need • Labels correspond to task of
to be related interest
Semi-supervised Learning (SSL)
Figure: source
Semi-supervised Learning (SSL)
Figure: source
(Some) Learning Paradigms
• Needs nice, clean labels • Noisy, often incorrect, labels • Needs nice, clean labels • No labels
• All data needs to be labeled • All data needs to be labeled • Small portion of data needs • No labels
• Labels correspond to task of • Labels might not correspond to be labeled • How does this work?
interest to task of interest, but need • Labels correspond to task of
to be related interest
(Some) Learning Paradigms
Active
Learning
• Human-in-the-loop
• Questions can be complete
labels or incomplete
information
Active Learning
• Human in the loop to ask questions/labels
Active Learning Hierarchical labels
Figure: source
Active + Weakly-supervised Learning
• Human in the loop to ask incomplete questions/labels
Figure: source
(Some) Learning Paradigms
Active
Learning
(Some) Learning Paradigms
Active Self-supervised/Predictive
Learning Learning
• Proxy-tasks
• Use supervision naturally arising
from data (without any human
provided labels)
Self-supervised/Predictive Learning
• Proxy-tasks (e.g., image colorization):
• Use supervision naturally arising from data
• No human provided labels
Unlabeled video
Figure: source
Self-supervised/Predictive Learning
Goal: representation learning
• Proxy-tasks (e.g., supervision from tracking): -Unsupervised object tracking
• Use supervision naturally arising from data in videos
• No human provided labels -Train model to assign similar
features to same object from
different frames
Figure: source
(Some) Learning Paradigms
Active Self-supervised/Predictive
Learning Learning
(Some) Learning Paradigms
Active Self-supervised/Predictive
Learning Learning
Reinforcement
Learning
Reinforcement Learning
• Learn in an interactive environment by sequential trial and error using
feedback/rewards from its own actions and experiences
Credit: source
“RLHF”
https://aws.amazon.com/what-is/reinforcement-learning-from-human-feedback/
(Some) Learning Paradigms
Active Self-supervised/Predictive
Learning Learning
Reinforcement
Learning
(Some) Learning Paradigms
Active Self-supervised/Predictive
Learning Life-long/Never-ending Learning
Learning
Reinforcement
Learning
Life-long/Never-ending Learning
Discover relationships between categories (e.g. tails are on animals like cats and dogs, tv
looks similar to computer monitor)
Paper: NEIL
Life-long/Never-ending Learning
Paper: NEIL
Life-long/Never-ending Learning
Paper: NEIL
(Some) Learning Paradigms
Active Self-supervised/Predictive
Learning Life-long/Never-ending Learning
Learning
Reinforcement
Learning
Next...
Neural networks, finally