1 of 27

INTRODUCTION TOMachine Learning�2nd Edition

ETHEM ALPAYDIN

© The MIT Press, 2010

alpaydin@boun.edu.tr

http://www.cmpe.boun.edu.tr/~ethem/i2ml2e

Lecture Slides for

2 of 27

CHAPTER 4: �Parametric Methods

3 of 27

Parametric Estimation

  • X = { xt }t where xt ~ p (x)
  • Parametric estimation:

Assume a form for p (x |θ ) and estimate θ , its sufficient statistics, using X

e.g., N ( μ, σ2) where θ = { μ, σ2}

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

3

4 of 27

Maximum Likelihood Estimation

  • Likelihood of θ given the sample X

l (θ|X) = p (X |θ) = ∏t p (xt|θ)

  • Log likelihood

L(θ|X) = log l (θ|X) = ∑t log p (xt|θ)

  • Maximum likelihood estimator (MLE)

θ* = argmaxθ L(θ|X)

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

4

5 of 27

Examples: Bernoulli/Multinomial

  • Bernoulli: Two states, failure/success, x in {0,1}

P (x) = pox (1 – po ) (1 – x)

L (po|X) = log ∏t poxt (1 – po ) (1 – xt)

MLE: po = ∑t xt / N

  • Multinomial: K>2 states, xi in {0,1}

P (x1,x2,...,xK) = ∏i pixi

L(p1,p2,...,pK|X) = log ∏t i pixit

MLE: pi = ∑t xit / N

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

5

6 of 27

Gaussian (Normal) Distribution

  • p(x) = N ( μ, σ2)

  • MLE for μ and σ2:

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

6

μ

σ

7 of 27

Bias and Variance

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

7

Unknown parameter θ

Estimator di = d (Xi) on sample Xi

Bias: bθ(d) = E [d] – θ

Variance: E [(dE [d])2]

Mean square error:

r (d,θ) = E [(dθ)2]

= (E [d] – θ)2 + E [(dE [d])2]

= Bias2 + Variance

θ

8 of 27

Bayes’ Estimator

  • Treat θ as a random var with prior p (θ)
  • Bayes’ rule: p (θ|X) = p(X|θ) p(θ) / p(X)
  • Full: p(x|X) = p(x|θ) p(θ|X)
  • Maximum a Posteriori (MAP): θMAP = argmaxθ p(θ|X)
  • Maximum Likelihood (ML): θML = argmaxθ p(X|θ)
  • Bayes’: θBayes’ = E[θ|X] = θ p(θ|X)

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

8

9 of 27

Bayes’ Estimator: Example

  • xt ~ N (θ, σo2) and θ ~ N ( μ, σ2)
  • θML = m
  • θMAP = θBayes’ =

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

9

10 of 27

Parametric Classification

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

10

11 of 27

  • Given the sample

  • ML estimates are

  • Discriminant becomes

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

11

12 of 27

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

12

Equal variances

Single boundary at

halfway between means

13 of 27

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

13

Variances are different

Two boundaries

14 of 27

Regression

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

14

15 of 27

Regression: From LogL to Error

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

15

16 of 27

Linear Regression

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

16

17 of 27

Polynomial Regression

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

17

18 of 27

Other Error Measures

  • Square Error:

  • Relative Square Error:

  • Absolute Error: E (θ |X) = t |rt g(xt| θ)|
  • ε-sensitive Error:

E (θ |X) = t 1(|rt g(xt| θ)|>ε) (|rt g(xt|θ)| – ε)

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

18

19 of 27

Bias and Variance

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

19

bias

variance

noise

squared error

20 of 27

Estimating Bias and Variance

  • M samples Xi={xti , rti}, i=1,...,M

are used to fit gi (x), i =1,...,M

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

20

21 of 27

Bias/Variance Dilemma

  • Example: gi(x)=2 has no variance and high bias

gi(x)= t rti/N has lower bias with variance

  • As we increase complexity,

bias decreases (a better fit to data) and

variance increases (fit varies more with data)

  • Bias/Variance dilemma: (Geman et al., 1992)

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

21

22 of 27

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

22

bias

variance

f

gi

g

f

23 of 27

Polynomial Regression

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

23

Best fit “min error”

24 of 27

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

24

Best fit, “elbow”

25 of 27

Model Selection

  • Cross-validation: Measure generalization accuracy by testing on data unused during training
  • Regularization: Penalize complex models

E’=error on data + λ model complexity

Akaike’s information criterion (AIC), Bayesian information criterion (BIC)

  • Minimum description length (MDL): Kolmogorov complexity, shortest description of data
  • Structural risk minimization (SRM)

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

25

26 of 27

Bayesian Model Selection

  • Prior on models, p(model)

  • Regularization, when prior favors simpler models
  • Bayes, MAP of the posterior, p(model|data)
  • Average over a number of models with high posterior (voting, ensembles: Chapter 17)

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

26

27 of 27

Regression example

Lecture Notes for E Alpaydın 2010 Introduction to Machine Learning 2e © The MIT Press (V1.0)

27

Coefficients increase in magnitude as order increases:

1: [-0.0769, 0.0016]

2: [0.1682, -0.6657, 0.0080]

3: [0.4238, -2.5778, 3.4675, -0.0002

4: [-0.1093, 1.4356,

-5.5007, 6.0454, -0.0019]