36
Learning From Data Lecture 14 Three Learning Principles Occam’s Razor Sampling Bias Data Snooping M. Magdon-Ismail CSCI 4100/6100

Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Learning From Data

Lecture 14

Three Learning Principles

Occam’s Razor

Sampling Bias

Data Snooping

M. Magdon-IsmailCSCI 4100/6100

Page 2: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

recap: Validation and Cross Validation

Validation Cross Validation

Dval

D

(N)

Dtrain

(N −K)

g

(K)

Eval(g )g

D1

D

g

g1

D2 · · ·

· · ·

Ecv

︸ ︷︷ ︸

take average

gN

g2

(x1, y1) (x2, y2) (xN , yN )

DN

e1 e2 eN· · ·

ModelSelection

H1 H2 H3 · · · HM

−−−→

−−−→

−−−→

−−−→

g1 g2 g3 · · · gM

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 2 /36 Occam, bias, snooping −→

Page 3: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

We Will Discuss . . .

•Occam’s Razor: pick a model carefully

• Sampling Bias: generate the data carefuly

•Data Snooping: handle the data carefully

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 3 /36 Occam −→

Page 4: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Occam’s Razor

use a ‘razor’ to ‘trim down’

“an explanation of the data to make it as simple as possible but no simpler.”

attributed to William of Occam (14th Century) and often mistakenly to Einstein

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 4 /36 Simpler is Better −→

Page 5: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Simpler is Better

The simplest model that fits the data is also the most plausible.

. . . or, beware of using complex models to fit data

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 5 /36 What is Simpler? −→

Page 6: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

What is Simpler?

simple hypothesis h simple hypothesis set H

Ω(h) Ω(H)

low order polynomial H with small dvc

hypothesis with small weights small number of hypotheses

easily described hypothesis low entropy set

... ...

The equivalence:

A hypothesis set with simple hypotheses must be small

We had a glimpse of this:

soft order constraint (smaller H)λ

←−−−−→ minimize Eaug (favors simpler h).

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 6 /36 Why is Simpler Better −→

Page 7: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Why is Simpler Better

Mathematically: simple curtails ability to fit noise, VC-dimension is small, and blah and blah . . .

simpler is better because you will be more “surprised” when you fit the data.

If something unlikely happens, it is very significant when it happens.

...

Detective Gregory: “Is there any other point to which you would wish to draw my attention?”

Sherlock Holmes: “To the curious incident of the dog in the night-time.”

Detective Gregory: “The dog did nothing in the night-time.”

Sherlock Holmes: “That was the curious incident.”...

– Silver Blaze, Sir Arthur Conan Doyle

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 7 /36 Scientific Experiment −→

Page 8: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

A Scientific Experiment

Axiom. If an experiment has no chance of falsifying a hypothesis, then the result ofthat experiment provides no evidence one way or the other for the hypothesis.

Scientist 1 Scientist 2 Scientist 3

temperature T

resistivityρ

temperature T

resistivityρ

temperature T

resistivityρ

no evidence very convincing some evidence?

Who provides most evidence for the hypothesis “ρ is linear in T ”?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 8 /36 Scientist 2 vs. 3 −→

Page 9: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Scientist 2 Versus Scientist 3

Axiom. If an experiment has no chance of falsifying a hypothesis, then the result ofthat experiment provides no evidence one way or the other for the hypothesis.

Scientist 1 Scientist 2 Scientist 3

temperature T

resistivityρ

temperature T

resistivityρ

temperature T

resistivityρ

no evidence very convincing some evidence?

Who provides most evidence?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 9 /36 Scientist 1 vs. 3 −→

Page 10: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Scientist 1 versus Scientist 3

Axiom. If an experiment has no chance of falsifying a hypothesis, then the result ofthat experiment provides no evidence one way or the other for the hypothesis.

Scientist 1 Scientist 2 Scientist 3

temperature T

resistivityρ

temperature T

resistivityρ

temperature T

resistivityρ

no evidence very convincing some evidence?

Who provides most evidence?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 10 /36 Non-Falsifiability −→

Page 11: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Axiom of Non-Falsifiability

Axiom. If an experiment has no chance of falsifying a hypothesis, then the result ofthat experiment provides no evidence one way or the other for the hypothesis.

Scientist 1 Scientist 2 Scientist 3

temperature T

resistivityρ

temperature T

resistivityρ

no evidence very convincing some evidence?

Who provides most evidence?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 11 /36 Falsification and mH(N) −→

Page 12: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Falsification and mH(N )

If H shatters x1, · · · ,xN ,

. . . don’t be surprised if you fit the data.

If H doesn’t shatter x1, · · · ,xN , and the target values are uniformly distributed,

P[falsification] ≥ 1−mH(N)

2N.

A good fit is surprising with simpler H (small mH(N)) and hence more significant.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 12 /36 Beyond Occam −→

Page 13: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Learning Goes Beyond Occam’s Razor

We may opt for ‘a simpler fit than possible’, namely an imperfect fit of the data

using a simple model over a perfect fit using a more complex one. The reason is

that the price we pay for a perfect fit in terms of the penalty for model complexity

may be too much in comparison to the benefit of the better fit.

– Learning From Data, Abu-Mostafa, Magdon-Ismail, Lin

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 13 /36 Puzzle 1: football oracle −→

Page 14: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

A Puzzle – The Football Oracle

Saturday, Oct 13, 2012

Home team will win the Monday Night Footbal Game.

This happens for 5 weeks in a row.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 14 /36 Got it right −→

Page 15: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

A Puzzle – The Football Oracle

Saturday, Oct 13, 2012

Home team will win the Monday Night Footbal Game. X

This happens for 5 weeks in a row.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 15 /36 5 weeks in a row −→

Page 16: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

A Puzzle – The Football Oracle

Saturday, Oct 13, 2012

Home team will the Monday Night Footbal Game. X

This happens for 5 weeks in a row.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 16 /36 Pay for more predictions −→

Page 17: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

A Puzzle – The Football Oracle . . . on the 6th week

Saturday, Nov 17, 2012

Call 1-900-555-5555 for winner; $50 charge applied

Ein = 0!

Meaningless without knowing the ‘complexity’ of the process leading to that!

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 17 /36 Oracle is a single predictor −→

Page 18: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

What did the Oracle Really Do?

you

day 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

day 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

day 3 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

day 4 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

day 5 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Single hypothesis that worked?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 18 /36 Oracle is every hypothesis −→

Page 19: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

What did the Oracle Really Do?

you

day 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

day 2 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

day 3 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0

day 4 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0

day 5 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

Every possible hypothesis one of which worked?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 19 /36 Pay for more predictions −→

Page 20: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

A Puzzle – The Football Oracle . . . on the 6th week

Saturday, Nov 17, 2012

Call 1-900-555-5555 for winner; $50 charge applied

Ein = 0!

Meaningless without the ‘complexity’ of the process leading to that!

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 20 /36 Sampling bias −→

Page 21: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

We Will Discuss . . .

•Occam’s Razor: pick a model carefully

• Sampling Bias: generate the data carefuly

•Data Snooping: handle the data carefully

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 21 /36 Dewey Defeats Truman −→

Page 22: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

November 3rd 1948, Dewey Defeats Truman

Tribune wanted to show off its latest technology

could go earlier to press.

Telephone poll on how people voted

statisticians had done their thing and were confident.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 22 /36 Truman defeats Dewey −→

Page 23: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Imagine Their Surprise When . . .

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 23 /36 Sampling Bias in Learning −→

Page 24: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Sampling Bias in Learning

If the data is sampled in a biased way, learning will producea similarly biased outcome.

. . . or, make sure the training and test distributions are the same.

You cannot draw a sample from one bin and make claims about another bin

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 24 /36 Extrapolation −→

Page 25: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Extrapolation

Amazon Ranking

#CopiesSold

2000 4000 6000 8000

20

40

60

80

100

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 25 /36 Extrapolation is Hard −→

Page 26: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Extrapolation is Hard

Amazon Ranking

#CopiesSold

2000 4000 6000 8000

20

40

60

80

100

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 26 /36 Dealing with Mismatch −→

Page 27: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Dealing with the Training-Test Mismatch

Think more carefully about what f should look like

Need some additional help outside the data, by choosing a good H

In our ranking example, account for the fat tail −→ hyperbola Amazon Ranking

#CopiesSold

2000 4000 6000 8000

20

40

60

80

100

(hyperbola fit)

Account for the training-test mismatch during learning

There are methods that reweight/resample data can help

If test data have zero representation in training, you are in trouble

— Think carefully about f Amazon Ranking

Probability

2000 4000 6000 80000

10−3

(test versus training distributions)

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 27 /36 Puzzle – credit analysis −→

Page 28: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Puzzle - Credit Analysis

• Determine credit given salary, debt, years in residence, . . . .

• Banks have lots of data

– customer information: salary, debt, etc.

– whether or not they defaulted on their credit.

age 32 years

gender male

salary 40,000

debt 26,000

years in job 1 year

years at home 3 years

. . . . . .

Approve for credit?

where is the sampling bias?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 28 /36 Bias in approvals −→

Page 29: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Puzzle - Credit Analysis

• Determine credit given salary, debt, years in residence, . . . .

• Banks have lots of data

– customer information: salary, debt, etc.

– whether or not who? defaulted on their credit.

age 32 years

gender male

salary 40,000

debt 26,000

years in job 1 year

years at home 3 years

. . . . . .

Approve for credit?

only data on approved customers

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 29 /36 Data Snooping −→

Page 30: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

We Will Discuss . . .

•Occam’s Razor: pick a model carefully

• Sampling Bias: generate the data carefuly

•Data Snooping: handle the data carefully

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 30 /36 Data snooping definition −→

Page 31: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Data Snooping

If a data set has affected any step in the learning process, itcannot be fully trusted in assessing the outcome.

. . . or, estimate performance with a completely uncontaminated test set

. . . and, choose H before looking at the data

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 31 /36 Puzzle – buy and hold on ‘S&P’ −→

Page 32: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Puzzle: The Buy and Hold Strategy on S&P 500 Stocks

16.2% return

1985 1990 1995 2000 2005 2010

Sampling Bias: didn’t buy and hold a random sample of stocks.

Snooping: Choose which stocks to hold by ‘snooping’ into the test set (the future).

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 32 /36 Actual S&P −→

Page 33: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Puzzle: The Buy and Hold Strategy on S&P 500 Stocks

16.2% return

snooping/sampling bias

actual S&P

8.3% return

1985 1990 1995 2000 2005 2010

Sampling Bias: didn’t buy and hold a random sample of stocks.

Snooping: Choose which stocks to hold by ‘snooping’ into the test set (the future).

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 33 /36 Data snooping is subtle −→

Page 34: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Data Snooping is a Subtle Happy Hell

• The data looks linear, so I will use a linear model, and it worked.If the data were different and didn’t look linear, would you do something different?

• Try linear, it fails; try circles it works.If you torture the data enough, it will confess.

• Try linear, it works; so I don’t need to try circles.Would you have tried circles if the data were different?

• Read papers, see what others did on the data. Modify and improve on that.If the data were different, would that modify what others did and hence what you did?

the data snooping can happen all at once or sequentially by different people

• Input normalization: normalize the data, now set aside the test set.Since the test set was involved in the normalization, wouldn’t your g change if the test set changed?

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 34 /36 Account for data snooping −→

Page 35: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Account for Data Snooping

Ask yourself: “If the data were different, could/would I have done something different?”if yes, then there is data snooping.

?h ∈ H ?

?g

Data

Dyour choices

−→ g

You must account for every choice influenced by D.

We know how to account for the choice of g from H.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 35 /36 Account for all data snooping −→

Page 36: Learning From Data Lecture 14 Three Learning Principlesmagdon/courses/LFD-Slides/SlidesLect14.pdf · 2019-09-30 · Learning From Data Lecture 14 Three Learning Principles Occam’s

Account for Data Snooping

Ask yourself: “If the data were different, could/would I have done something different?”if yes, then there is data snooping.

?h ∈ H ?

?g

Data

Dyour choices

−→ g

You must account for every choice influenced by D.

We know how to account for the choice of g from H.

c© AML Creator: Malik Magdon-Ismail Three Learning Principles: 36 /36