42
ECE 5984: Introduction to Machine Learning Dhruv Batra Virginia Tech Topics: Probability Review Statistical Estimation (MLE) Readings: Barber 8.1, 8.2

ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

  • Upload
    others

  • View
    19

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

ECE 5984: Introduction to Machine Learning

Dhruv Batra Virginia Tech

Topics: –  Probability Review –  Statistical Estimation (MLE)

Readings: Barber 8.1, 8.2

Page 2: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Administrativia •  HW1

–  Due on Sun 02/15, 11:55pm –  http://inclass.kaggle.com/c/VT-ECE-Machine-Learning-HW1

(C) Dhruv Batra 2

Page 3: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Project •  Groups of 1-3

–  we prefer teams of 2

•  Deliverables: –  Project proposal (NIPS format): 2 page, due Feb 24 –  Midway presentations (in class) –  Final report: webpage with results

(C) Dhruv Batra 3

Page 4: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Proposal •  2 Page (NIPS format)

–  http://nips.cc/Conferences/2013/PaperInformation/StyleFiles

•  Necessary Information: –  Project title –  Project idea.

•  This should be approximately two paragraphs. –  Data set details

•  Ideally existing dataset. No data-collection projects. –  Software

•  Which libraries will you use? •  What will you write?

–  Papers to read. •  Include 1-3 relevant papers. You will probably want to read at least one of them

before submitting your proposal. –  Teammate

•  Will you have a teammate? If so, what’s the break-down of labor? Maximum team size is 3 students.

–  Mid-sem Milestone •  What will you complete by the project milestone due date? Experimental results

of some kind are expected here.

(C) Dhruv Batra 4

Page 5: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Project •  Rules

–  Must be about machine learning –  Must involve real data

•  Use your own data or take from class website

–  Can apply ML to your own research. •  Must be done this semester.

–  OK to combine with other class-projects •  Must declare to both course instructors •  Must have explicit permission from BOTH instructors •  Must have a sufficient ML component

–  Using libraries •  No need to implement all algorithms •  OK to use standard SVM, MRF, Decision-Trees, etc libraries •  More thought+effort => More credit

(C) Dhruv Batra 5

Page 6: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Project •  Main categories

–  Application/Survey •  Compare a bunch of existing algorithms on a new application domain of

your interest

–  Formulation/Development •  Formulate a new model or algorithm for a new or old problem

–  Theory •  Theoretically analyze an existing algorithm

•  Support –  List of ideas, pointers to dataset/algorithms/code

•  https://filebox.ece.vt.edu/~s15ece5984/project.html •  We will mentor teams and give feedback.

(C) Dhruv Batra 6

Page 7: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Administrativia •  HW1

–  Due on Sun 02/15, 11:55pm –  http://inclass.kaggle.com/c/VT-ECE-Machine-Learning-HW1

•  Project Proposal –  Due: Tue 02/24, 11:55 pm –  <=2pages, NIPS format

(C) Dhruv Batra 7

Page 8: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Procedural View •  Training Stage:

–  Raw Data à x (Feature Extraction) –  Training Data { (x,y) } à f (Learning)

•  Testing Stage –  Raw Data à x (Feature Extraction) –  Test Data x à f(x) (Apply function, Evaluate error)

(C) Dhruv Batra 8

Page 9: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Statistical Estimation View •  Probabilities to rescue:

–  x and y are random variables –  D = (x1,y1), (x2,y2), …, (xN,yN) ~ P(X,Y)

•  IID: Independent Identically Distributed –  Both training & testing data sampled IID from P(X,Y) –  Learn on training set –  Have some hope of generalizing to test set

(C) Dhruv Batra 9

Page 10: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Plan for Today •  Review of Probability

–  Discrete vs Continuous Random Variables –  PMFs vs PDF –  Joint vs Marginal vs Conditional Distributions –  Bayes Rule and Prior

•  Statistical Learning / Density Estimation –  Maximum Likelihood –  Maximum A Posteriori –  Bayesian Estimation

•  We will discuss simple examples (like coin toss), but these SAME concepts will apply to sophisticated problems.

(C) Dhruv Batra 10

Page 11: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Probability •  The world is a very uncertain place

•  30 years of Artificial Intelligence and Database research danced around this fact

•  And then a few AI researchers decided to use some ideas from the eighteenth century

(C) Dhruv Batra 11 Slide Credit: Andrew Moore

Page 12: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Probability •  A is non-deterministic event

–  Can think of A as a boolean-valued variable

•  Examples –  A = your next patient has cancer –  A = Rafael Nada wins French Open 2015

(C) Dhruv Batra 12

Page 13: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Interpreting Probabilities •  What does P(A) mean?

•  Frequentist View –  limit Nà∞ #(A is true)/N –  limiting frequency of a repeating non-deterministic event

•  Bayesian View –  P(A) is your “belief” about A

•  Market Design View –  P(A) tells you how much you would bet

(C) Dhruv Batra 13

Page 14: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

(C) Dhruv Batra 14 Image Credit: Intrade / NPR

Page 15: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

(C) Dhruv Batra 15

7

The Axioms Of Probability

Slide Credit: Andrew Moore

Page 16: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Axioms of Probability •  0<= P(A) <= 1 •  P(empty-set) = 0 •  P(everything) = 1 •  P(A or B) = P(A) + P(B) – P(A and B)

(C) Dhruv Batra 16

Page 17: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Interpreting the Axioms •  0<= P(A) <= 1 •  P(empty-set) = 0 •  P(everything) = 1 •  P(A or B) = P(A) + P(B) – P(A and B)

(C) Dhruv Batra 17 Image Credit: Andrew Moore 6

Visualizing A

Event space of all possible worlds

Its area is 1Worlds in which A is False

Worlds in which A is true

P(A) = Area ofreddish oval

Page 18: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Interpreting the Axioms •  0<= P(A) <= 1 •  P(empty-set) = 0 •  P(everything) = 1 •  P(A or B) = P(A) + P(B) – P(A and B)

(C) Dhruv Batra 18 Image Credit: Andrew Moore

8

The Axioms Of Probability5 0 <= P(A) <= 1

5 P(True) = 1

5 P(False) = 0

5 P(A or B) = P(A) + P(B) - P(A and B)

The area of A canDt get any smaller than 0

And a zero area would mean no world could ever have A true

Page 19: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Interpreting the Axioms •  0<= P(A) <= 1 •  P(empty-set) = 0 •  P(everything) = 1 •  P(A or B) = P(A) + P(B) – P(A and B)

(C) Dhruv Batra 19 Image Credit: Andrew Moore

9

Interpreting the axioms1 0 <= P(A) <= 1

1 P(True) = 1

1 P(False) = 0

1 P(A or B) = P(A) + P(B) - P(A and B)

The area of A canDt get any bigger than 1

And an area of 1 would mean all worlds will have A true

Page 20: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Interpreting the Axioms •  0<= P(A) <= 1 •  P(empty-set) = 0 •  P(everything) = 1 •  P(A or B) = P(A) + P(B) – P(A and B)

(C) Dhruv Batra 20 Image Credit: Andrew Moore

11

A

B

Interpreting the axioms3 0 <= P(A) <= 13 P(True) = 13 P(False) = 03 P(A or B) = P(A) + P(B) - P(A and B)

P(A or B)

BP(A and B)

Simple addition and subtraction

Page 21: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Concepts •  Sample Space

–  Space of events

•  Random Variables –  Mapping from events to numbers –  Discrete vs Continuous

•  Probability –  Mass vs Density

(C) Dhruv Batra 21

Page 22: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

XX

p(X = x)p(x)

0 p(x) 1 for all x 2 XX

x2Xp(x) = 1

discrete random variable sample space of possible outcomes,

which may be finite or countably infinite x 2 X outcome of sample of discrete random variable

probability distribution (probability mass function)

shorthand used when no ambiguity

X = {1, 2, 3, 4}

(C) Dhruv Batra Slide Credit: Erik Suddherth degenerate distribution uniform distribution 22

or Val(X)

Discrete Random Variables

Page 23: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Continuous Random Variables •  On board

(C) Dhruv Batra 23

Page 24: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Concepts •  Expectation

•  Variance

(C) Dhruv Batra 24

Page 25: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Most Important Concepts •  Marginal distributions / Marginalization

•  Conditional distribution / Chain Rule

•  Bayes Rule

(C) Dhruv Batra 25

Page 26: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Joint Distribution

(C) Dhruv Batra 26

Page 27: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Marginalization •  Marginalization

–  Events: P(A) = P(A and B) + P(A and not B)

–  Random variables

(C) Dhruv Batra 27

P(X = x) = P(X = x,Y = y)y∑

Page 28: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Marginal Distributions

p(x, y) =X

z2Zp(x, y, z)

p(x) =X

y2Yp(x, y)

(C) Dhruv Batra Slide Credit: Erik Suddherth 28

Page 29: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Conditional Probabilities •  P(Y=y | X=x)

•  What do you believe about Y=y, if I tell you X=x?

•  P(Rafael Nadal wins French Open 2015)?

•  What if I tell you: –  He has won the French Open 9/10 he has played there –  Novak Djokovic is ranked 1; just won Australian Open –  I offered a similar analysis last year and Nadal won

(C) Dhruv Batra 29

Page 30: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Conditional Probabilities •  P(A | B) = In worlds that where B is true,

fraction where A is true

•  Example –  H: “Have a headache” –  F: “Coming down with Flu”

(C) Dhruv Batra 30 14

Conditional Probability

0 P(A|B) = Fraction of worlds in which B is true

that also have A true

F

H

H = AHave a headacheB

F = AComing down with FluB

P(H) = 1/10

P(F) = 1/40

P(H|F) = 1/2

AHeadaches are rare and flu

is rarer, but if youIre coming

down with Jflu thereIs a 50-

50 chance youIll have a

headache.B

14

Conditional Probability

0 P(A|B) = Fraction of worlds in which B is true

that also have A true

F

H

H = AHave a headacheB

F = AComing down with FluB

P(H) = 1/10

P(F) = 1/40

P(H|F) = 1/2

AHeadaches are rare and flu

is rarer, but if youIre coming

down with Jflu thereIs a 50-

50 chance youIll have a

headache.B

Page 31: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Conditional Distributions

p(x, y | Z = z) =p(x, y, z)

p(z)(C) Dhruv Batra Slide Credit: Erik Sudderth 31

Page 32: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Conditional Probabilities •  Definition

•  Corollary: Chain Rule

(C) Dhruv Batra 32

Page 33: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Independent Random Variables

p(x, y) = p(x)p(y)

X ? Y

for all x 2 X , y 2 Y

(C) Dhruv Batra Slide Credit: Erik Sudderth 33

Page 34: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

•  Sets of variables X, Y

•  X is independent of Y –  Shorthand: P Ⱶ (X ⊥ Y)

•  Proposition: P satisfies (X ⊥ Y) if and only if –  P(X=x,Y=y) = P(X=x) P(Y=y), ∀x∈Val(X), y∈Val(Y)

Marginal Independence

(C) Dhruv Batra 34

Page 35: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

•  Sets of variables X, Y, Z

•  X is independent of Y given Z if –  Shorthand: P Ⱶ (X ⊥ Y | Z) –  For P Ⱶ (X ⊥ Y |∅), write P Ⱶ (X ⊥ Y)

•  Proposition: P satisfies (X ⊥ Y | Z) if and only if –  P(X,Y|Z) = P(X|Z) P(Y|Z), ∀x∈Val(X), y∈Val(Y), z∈Val(Z)

Conditional independence

(C) Dhruv Batra 35

Page 36: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Concept •  Bayes Rules

–  Simple yet fundamental

(C) Dhruv Batra 36 20

What we just did/P(A ^ B) P(A|B) P(B)

P(B|A) = ----------- = ---------------P(A) P(A)

This is Bayes Rule

Bayes, Thomas (1763) An essay towards solving a problem in the doctrine of chances. Philosophical Transactions of the Royal Society of London, 53:370-418

Image Credit: Andrew Moore

Page 37: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Bayes Rule •  Simple yet profound

–  Using Bayes Rules doesn’t make your analysis Bayesian!

•  Concepts: –  Likelihood

•  How much does a certain hypothesis explain the data?

–  Prior •  What do you believe before seeing any data?

–  Posterior •  What do we believe after seeing the data?

(C) Dhruv Batra 37

Page 38: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

Entropy

(C) Dhruv Batra 38 Slide Credit: Sam Roweis

Page 39: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

KL-Divergence / Relative Entropy

(C) Dhruv Batra 39 Slide Credit: Sam Roweis

Page 40: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

KL-Divergence / Relative Entropy

(C) Dhruv Batra 40 Image Credit: Wikipedia

•  a

Page 41: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

KL-Divergence / Relative Entropy

(C) Dhruv Batra 41 Image Credit: Wikipedia

•  a

Page 42: ECE 5984: Introduction to Machine Learnings15ece5984/slides/L5_prob.pptx.pdf · ECE 5984: Introduction to Machine Learning ... – Probability Review – Statistical Estimation (MLE)

•  End of Prob. Review

•  Start of Estimation

(C) Dhruv Batra 42