46
Semi-Supervised Learning Jia-Bin Huang Virginia Tech Spring 2019 ECE-5424G / CS-5824

Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-Supervised Learning

Jia-Bin Huang

Virginia Tech Spring 2019ECE-5424G / CS-5824

Page 2: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Administrative

• HW 4 due April 10

Page 3: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Recommender Systems

• Motivation

• Problem formulation

• Content-based recommendations

• Collaborative filtering

• Mean normalization

Page 4: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Problem motivationMovie Alice (1) Bob (2) Carol (3) Dave (4) 𝑥1

(romance)𝑥2

(action)

Love at last 5 5 0 0 0.9 0

Romanceforever

5 ? ? 0 1.0 0.01

Cute puppies of love

? 4 0 ? 0.99 0

Nonstop carchases

0 0 5 4 0.1 1.0

Swords vs.karate

0 0 5 ? 0 0.9

Page 5: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Problem motivationMovie Alice (1) Bob (2) Carol (3) Dave (4) 𝑥1

(romance)𝑥2

(action)

Love at last 5 5 0 0 ? ?

Romanceforever

5 ? ? 0 ? ?

Cute puppies of love

? 4 0 ? ? ?

Nonstop carchases

0 0 5 4 ? ?

Swords vs.karate

0 0 5 ? ? ?

𝜃 1 =050

𝜃 2 =050

𝜃 3 =005

𝜃 4 =005

𝑥 1 =???

Page 6: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Optimization algorithm

• Given 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 , to learn 𝑥(𝑖):

min𝑥(𝑖)

1

2

𝑗:𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

• Given 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 , to learn 𝑥(1), 𝑥(2), ⋯ , 𝑥(𝑛𝑚):

min𝑥(1),𝑥(2),⋯,𝑥(𝑛𝑚)

1

2

𝑖=1

𝑛𝑚

𝑗:𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

Page 7: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering

•Given 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 (and movie ratings),

Can estimate 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢

•Given 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢

Can estimate 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚

Page 8: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering optimization objective• Given 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 , estimate 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢

min𝜃 1 ,𝜃 2 ,⋯,𝜃 𝑛𝑢

1

2

𝑗=1

𝑛𝑢

𝑖:𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑗=1

𝑛𝑢

𝑘=1

𝑛

𝜃𝑘𝑗

2

• Given 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 , estimate 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚

min𝑥(1),𝑥(2),⋯,𝑥(𝑛𝑚)

1

2

𝑖=1

𝑛𝑚

𝑗:𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

Page 9: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering optimization objective

• Given 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 , estimate 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢

min𝜃 1 ,𝜃 2 ,⋯,𝜃 𝑛𝑢

1

2

𝑗=1

𝑛𝑢

𝑖:𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑗=1

𝑛𝑢

𝑘=1

𝑛

𝜃𝑘𝑗

2

• Given 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 , estimate 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚

min𝑥(1),𝑥(2),⋯,𝑥(𝑛𝑚)

1

2

𝑖=1

𝑛𝑚

𝑗:𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

• Minimize 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 and 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 simultaneously

𝐽 =1

2

𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑗=1

𝑛𝑢

𝑘=1

𝑛

𝜃𝑘𝑗

2+

𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

Page 10: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering optimization objective

𝐽(𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 , 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 ) =

1

2

𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑗=1

𝑛𝑢

𝑘=1

𝑛

𝜃𝑘𝑗

2+

𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

Page 11: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering algorithm• Initialize 𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 , 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 to small random values

• Minimize 𝐽(𝑥 1 , 𝑥 2 , ⋯ , 𝑥 𝑛𝑚 , 𝜃 1 , 𝜃 2 , ⋯ , 𝜃 𝑛𝑢 ) using gradient descent (or an advanced optimization algorithm). For every 𝑗 =1⋯𝑛𝑢, 𝑖 = 1,⋯ , 𝑛𝑚:

𝑥𝑘𝑗≔ 𝑥𝑘

𝑗− 𝛼

𝑗:𝑟 𝑖,𝑗 =1

( 𝜃 𝑗 ⊤𝑥 𝑖 − 𝑦 𝑖,𝑗 ) 𝜃𝑘

𝑖+ 𝜆 𝑥𝑘

(𝑖)

𝜃𝑘𝑗≔ 𝜃𝑘

𝑗− 𝛼

𝑖:𝑟 𝑖,𝑗 =1

( 𝜃 𝑗 ⊤𝑥 𝑖 − 𝑦 𝑖,𝑗 ) 𝑥𝑘

𝑖+ 𝜆 𝜃𝑘

(𝑗)

• For a user with parameter 𝜃 and movie with (learned) feature 𝑥, predict a star rating of 𝜃⊤𝑥

Page 12: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering

Movie Alice (1) Bob (2) Carol (3) Dave (4)

Love at last 5 5 0 0

Romance forever 5 ? ? 0

Cute puppies oflove

? 4 0 ?

Nonstop car chases 0 0 5 4

Swords vs. karate 0 0 5 ?

Page 13: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Collaborative filtering

• Predicted ratings:

𝑋 =

− 𝑥 1 ⊤−

− 𝑥 2 ⊤−

− 𝑥 𝑛𝑚⊤−

Θ =

− 𝜃 1 ⊤−

− 𝜃 2 ⊤−

− 𝜃 𝑛𝑢⊤−

Y = XΘ⊤

Low-rank matrix factorization

Page 14: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Finding related movies/products

• For each product 𝑖, we learn a feature vector 𝑥(𝑖) ∈ 𝑅𝑛

𝑥1: romance, 𝑥2: action, 𝑥3: comedy, …

• How to find movie 𝑗 relate to movie 𝑖?

Small 𝑥(𝑖) − 𝑥(𝑗) movie j and I are “similar”

Page 15: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Recommender Systems

• Motivation

• Problem formulation

• Content-based recommendations

• Collaborative filtering

• Mean normalization

Page 16: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Users who have not rated any movies

1

2

𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑗=1

𝑛𝑢

𝑘=1

𝑛

𝜃𝑘𝑗

2+

𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

𝜃(5) =00

Movie Alice (1) Bob (2) Carol (3) Dave (4) Eve (5)

Love at last 5 5 0 0 ?

Romanceforever

5 ? ? 0 ?

Cute puppies of love

? 4 0 ? ?

Nonstop carchases

0 0 5 4 ?

Swords vs.karate

0 0 5 ? ?

Page 17: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Users who have not rated any movies

1

2

𝑟 𝑖,𝑗 =1

(𝜃 𝑗 )⊤ 𝑥 𝑖 − 𝑦 𝑖,𝑗 2+𝜆

2

𝑗=1

𝑛𝑢

𝑘=1

𝑛

𝜃𝑘𝑗

2+

𝜆

2

𝑖=1

𝑛𝑚

𝑘=1

𝑛

𝑥𝑘(𝑖) 2

𝜃(5) =00

Movie Alice (1) Bob (2) Carol (3) Dave (4) Eve (5)

Love at last 5 5 0 0 0

Romanceforever

5 ? ? 0 0

Cute puppies of love

? 4 0 ? 0

Nonstop carchases

0 0 5 4 0

Swords vs.karate

0 0 5 ? 0

Page 18: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Mean normalization

For user 𝑗, on movie 𝑖 predict:

𝜃 𝑗 ⊤𝑥(𝑖) + 𝜇𝑖

User 5 (Eve):

𝜃 5 =00

𝜃 5 ⊤𝑥(𝑖) + 𝜇𝑖

Learn 𝜃(𝑗), 𝑥(𝑖)

Page 19: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Recommender Systems

• Motivation

• Problem formulation

• Content-based recommendations

• Collaborative filtering

• Mean normalization

Page 20: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Review: Supervised Learning

• K nearest neighbor

• Linear Regression

• Naïve Bayes

• Logistic Regression

• Support Vector Machines

• Neural Networks

Page 21: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Review: Unsupervised Learning

• Clustering, K-Mean

• Expectation maximization

• Dimensionality reduction

• Anomaly detection

• Recommendation system

Page 22: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Advanced Topics

• Semi-supervised learning

• Probabilistic graphical models

• Generative models

• Sequence prediction models

• Deep reinforcement learning

Page 23: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

• Motivation

• Problem formulation

• Consistency regularization

• Entropy-based method

• Pseudo-labeling

Page 24: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

• Motivation

• Problem formulation

• Consistency regularization

• Entropy-based method

• Pseudo-labeling

Page 25: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Classic Paradigm Insufficient Nowadays

• Modern applications: massive amounts of raw data.

• Only a tiny fraction can be annotated by human experts

Protein sequences Billions of webpages Images

Page 26: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

Page 27: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Active Learning

Page 28: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

• Motivation

• Problem formulation

• Consistency regularization

• Entropy-based method

• Pseudo-labeling

Page 29: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning Problem Formulation• Labeled data

𝑆𝑙 = 𝑥 1 , 𝑦 1 , 𝑥 2 , 𝑦 2 , ⋯ , 𝑥 𝑚𝑙 , 𝑦 𝑚𝑙

• Unlabeled data

𝑆𝑢 = 𝑥 1 , 𝑦 1 , 𝑥 2 , 𝑦 2 , ⋯ , 𝑥 𝑚𝑢 , 𝑦 𝑚𝑢

• Goal: Learn a hypothesis ℎ𝜃 (e.g., a classifier) that has small error

Page 30: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Combining labeled and unlabeled data- Classical methods• Transductive SVM [Joachims ’99]

• Co-training [Blum and Mitchell ’98]

• Graph-based methods [Blum and Chawla ‘01] [Zhu, Ghahramani, Lafferty ‘03]

Page 31: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Transductive SVM

• The separator goes through low density regions of the space / large margin

Page 32: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

SVMInputs:

𝑥l(𝑖), 𝑦l

(𝑖)

min𝜃

1

2σ𝑗=1𝑛 𝜃𝑗

2

s. t. 𝑦l(𝑖)𝜃⊤𝑥𝑙

𝑖≥ 1

Transductive SVMInputs:

𝑥l(𝑖), 𝑦l

(𝑖), 𝑥u

(𝑖), 𝑦𝑢

(𝑖)

min𝜃

1

2σ𝑗=1𝑛 𝜃𝑗

2

s. t. 𝑦l(𝑖)𝜃⊤𝑥𝑙

𝑖≥ 1

𝑦u(𝑖)𝜃⊤𝑥 𝑖 ≥ 1

𝑦u

𝑖∈ {−1, 1}

Page 33: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Transductive SVMs

• First maximize margin over the labeled points

• Use this to give initial labels to unlabeled points based on this separator.

• Try flipping labels of unlabeled points to see if doing so can increase margin

Page 34: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Deep Semi-supervised Learning

Page 35: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

• Motivation

• Problem formulation

• Consistency regularization

• Entropy-based method

• Pseudo-labeling

Page 36: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Stochastic Perturbations/Π-Model

•Realistic perturbations 𝑥 → ො𝑥 of data points 𝑥 ∈ 𝐷𝑈𝐿should not significantly change the output of h𝜃(𝑥)

Page 37: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Temporal Ensembling

Page 38: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Mean Teacher

Page 39: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Virtual Adversarial Training

Page 40: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

• Motivation

• Problem formulation

• Consistency regularization

• Entropy-based method

• Pseudo-labeling

Page 41: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

EntMin

• Encourages more confident predictions on unlabeled data.

Page 42: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Semi-supervised Learning

• Motivation

• Problem formulation

• Consistency regularization

• Entropy-based method

• Pseudo-labeling

Page 43: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Comparison

Page 44: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Varying number of labels

Page 45: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Class mismatch in Labeled/Unlabeled datasets hurts the performance

Page 46: Semi-Supervised Learningjbhuang/teaching/ECE5424-CS... · 2019. 4. 8. · Collaborative filtering optimization ... Low-rank matrix factorization. Finding related movies/products

Lessons

• Standardized architecture + equal budget for tuning hyperparameters

• Unlabeled data from a different class distribution not that useful

• Most methods don’t work well in the very low labeled-data regime

• Transferring Pre-Trained Imagenet produces lower error rate

• Conclusions based on small datasets though