machine learning (cse 446): generative adversarial ... · machine learning (cse 446): generative...

16
Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington [email protected] 0 / 12

Upload: others

Post on 21-Sep-2020

23 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Machine Learning (CSE 446):Generative Adversarial Networks (GANs)

Sham M Kakadec© 2019

University of [email protected]

0 / 12

Page 2: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Announcements

I Weds is the final.

I One page of notes.

I List of topics posted tomorrow.

0 / 12

Page 3: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Class results with random Fourier features, HW3, Q7

1 / 12

Page 4: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Image Generation

These are computer generated images from the “bigGAN”.

2 / 12

Page 5: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Classification

I SPAM detection.

I x is an email.

I Suppose Q(x) is the distribution over true emails.

I Suppose G(x) is spammer’s generative distribution over emails.

I usual supervised learning: make a dataset of (x, y) pairs, say with 50% labeledtrue and 50% spam.

I suppose Prθ(Y = 1|X) = Dθ(X) is our model’s probably of that Y = 1, trueemail.

3 / 12

Page 6: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Building Our Classifier

I Maximum likelihood is:maxθ

E log Prθ(Y = 1|X)

I every θ corresponds to some model D.

I If our data is equally split, where all the Y = 1’s come from Q and and all theY = 0’s come from G, then:

maxθ

E log Prθ(Y = 1|X) =

maxD

(Ex∼Q[

1

2logD(x)] +

1

2Ex∼G[log(1−D(x))]

)I Likelihood function:L(D,G) =

4 / 12

Page 7: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

The Spammer’s Job

I If the spam detector D was fixed, then our spammer wants to:

minGL(G,D)

I The spammer wants to make the discriminator D’s likelihood small.

5 / 12

Page 8: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

We have a game:

I Let’s think more abstractly: D is procedure to spot fake images, G is a procedureto generate images.

I The game can be viewed as:

minG

maxD

L(G,D) =

minG

maxD

(Ex∼Q[

1

2logD(x)] +

1

2Ex∼G[log(1−D(x))]

)I Is this a powerful idea?

Remember AD:

6 / 12

Page 9: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

the Discriminator

I just binary image classification “fake or not”

I we know how to do supervised learning

I for a given G and samples from the truth Q, we can learn D.

7 / 12

Page 10: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

the Generator

I what is a model for generating images?and how do we update G the model?

I let say z ∼ N(0, I) where I is a d× d matrix.

I a network:

8 / 12

Page 11: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

the Generator network

9 / 12

Page 12: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Learning

I Fix G, update D.easy: just supervised learning.

I Now fix D. Recall:

L(G,D) =

(Ex∼Q[

1

2logD(x)] +

1

2Ex∼G[log(1−D(x))]

)=

(Ex∼Q[

1

2logD(x)] +

1

2Ez∼Normal(0,I)[log(1−D(G(z)))]

)

I We can estimate this loss easily. Why?

I Update G: how?

10 / 12

Page 13: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Convergence/Comments

I Does it converge?Subtle: we are not ”hill climbing” on an on an objective.

I at best, we can get to an equilibrium.I Comparison to EM and likelihood based approaches:

I Computing the the probability of x under G is difficult.difficulty for EM.

I “mode collapse” with GANssampling distribution not reflective of the truth.

I NLP generative methods do not use GANs!(better results with direct training approaches)

11 / 12

Page 14: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Whichfaceisreal.com

11 / 12

Page 15: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

We can get creativeStyle transfer. From the “cycleGAN”

11 / 12

Page 16: Machine Learning (CSE 446): Generative Adversarial ... · Machine Learning (CSE 446): Generative Adversarial Networks (GANs) Sham M Kakade c 2019 University of Washington cse446-staff@cs.washington.edu

Thank you!!

Thank you for the hard work!

I Good luck on the final and have a great spring break.

I You have a good toolkit.Please participate in the larger ML community!

12 / 12