lecture 02: bayesian decision theory

34
ECE 8443 – Pattern Recognition ECE 8527 – Introduction to Machine Learning and Pattern Recognition LECTURE 02: BAYESIAN DECISION THEORY Objectives: Bayes Rule Minimum Error Rate Decision Surfaces Gaussian Distributions Resources: D.H.S: Chapter 2 (Part 1) D.H.S: Chapter 2 (Part 2) R.G.O. : Intro to PR

Upload: lalo

Post on 24-Feb-2016

57 views

Category:

Documents


0 download

DESCRIPTION

LECTURE 02: BAYESIAN DECISION THEORY. Objectives: Bayes Rule Minimum Error Rate Decision Surfaces Gaussian Distributions Resources: D.H.S: Chapter 2 (Part 1) D.H.S: Chapter 2 (Part 2) R.G.O. : Intro to PR. Probability Decision Theory. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8443 – Pattern RecognitionECE 8527 – Introduction to Machine Learning and Pattern Recognition

LECTURE 02: BAYESIAN DECISION THEORY

• Objectives:Bayes RuleMinimum Error RateDecision SurfacesGaussian Distributions

• Resources:D.H.S: Chapter 2 (Part 1)D.H.S: Chapter 2 (Part 2)R.G.O. : Intro to PR

Page 2: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 2

• Bayesian decision theory is a fundamental statistical approach to the problem of pattern classification.

• Quantify the tradeoffs between various classification decisions using probability and the costs that accompany these decisions.

• Assume all relevant probability distributions are known (later we will learn how to estimate these from data).

• Can we exploit prior knowledge in our fish classification problem: Are the sequence of fish predictable? (statistics) Is each class equally probable? (uniform priors) What is the cost of an error? (risk, optimization)

Probability Decision Theory

Page 3: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 3

• State of nature is prior information• Model as a random variable, ω:

ω = ω1: the event that the next fish is a sea bass category 1: sea bass; category 2: salmon P(ω1) = probability of category 1 P(ω2) = probability of category 2 P(ω1) + P( ω2) = 1

Exclusivity: ω1 and ω2 share no basic events Exhaustivity: the union of all outcomes is the sample space

(either ω1 or ω2 must occur)• If all incorrect classifications have an equal cost:

Decide ω1 if P(ω1) > P(ω2); otherwise, decide ω2

Prior Probabilities

Page 4: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 4

• A decision rule with only prior information always produces the same result and ignores measurements.

• If P(ω1) >> P(ω2), we will be correct most of the time.

• Probability of error: P(E) = min(P(ω1),P(ω2)).

• Given a feature, x (lightness), which is a continuous random variable, p(x|ω2) is the class-conditional probability density function:

• p(x|ω1) and p(x|ω2) describe the difference in lightness between populations of sea and salmon.

Class-Conditional Probabilities

Page 5: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 5

• A probability density function is denoted in lowercase and represents a function of a continuous variable.

• px(x|ω), often abbreviated as p(x), denotes a probability density function for the random variable X. Note that px(x|ω) and py(y|ω) can be two different functions.

• P(x|ω) denotes a probability mass function, and must obey the following constraints:

1 XxP(x)

0)( xP

• Probability mass functions are typically used for discrete random variables while densities describe continuous random variables (latter must be integrated).

Probability Functions

Page 6: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 6

• Suppose we know both P(ωj) and p(x|ωj), and we can measure x. How does this influence our decision?

• The joint probability of finding a pattern that is in category j and that this pattern has a feature value of x is:

xpPxp

xP jjj

jj

j Pxpxp

2

1

where in the case of two categories:

jjjj PxpxpxPxp ),(

• Rearranging terms, we arrive at Bayes formula:

Bayes Formula

Page 7: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 7

• Bayes formula:

can be expressed in words as:

• By measuring x, we can convert the prior probability, P(ωj), into a posterior probability, P(ωj|x).

• Evidence can be viewed as a scale factor and is often ignored in optimization applications (e.g., speech recognition).

xpPxp

xP jjj

evidencepriorlikelihoodposterior

Posterior Probabilities

Page 8: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 8

• For every value of x, the posteriors sum to 1.0.

• At x=14, the probability it is in category ω2 is 0.08, and for category ω1 is 0.92.

• Two-class fish sorting problem (P(ω1) = 2/3, P(ω2) = 1/3):

Posteriors Sum To 1.0

Page 9: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 9

• Decision rule: For an observation x, decide ω1 if P(ω1|x) > P(ω2|x); otherwise, decide ω2

• Probability of error:

• The average probability of error is given by:

• If for every x we ensure that is as small as possible, then the integral is as small as possible.

• Thus, Bayes decision rule minimizes .

21

12

)()(

|

xxPxxP

xerrorP

dxxpxerrorPdxxerrorPerrorP )()|(),()(

)](),(min[)|( 21 xPxPxerrorP

Bayes Decision Rule

)|( xerrorP

)|( xerrorP

Page 10: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 10

• The evidence, , is a scale factor that assures conditional probabilities sum to 1:

• We can eliminate the scale factor (which appears on both sides of the equation):

• Special cases:

: x gives us no useful information.

: decision is based entirely on the likelihood .

Evidence

1PP 21 xx

)()( 22111 PxpPxpiffx

21 xpxp

)()( 21 PP ixp

xp

Page 11: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 11

• Generalization of the preceding ideas: Use of more than one feature

(e.g., length and lightness) Use more than two states of nature

(e.g., N-way classification) Allowing actions other than a decision to decide on the state of nature

(e.g., rejection: refusing to take an action when alternatives are close or confidence is low)

Introduce a loss of function which is more general than the probability of error (e.g., errors are not equally costly)

Let us replace the scalar x by the vector, x, in a d-dimensional Euclidean space, Rd, called the feature space.

Generalization of the Two-Class Problem

Page 12: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 12

• Let {ω1, ω2,…, ωc} be the set of “c” categories• Let {ω1, ω2,…, ωa} be the set of “a” possible actions• Let ω(ωi|ωj) be the loss incurred for taking action ωi

when the state of nature is ωj

• The posterior, , can be computed from Bayes formula:

where the evidence is:

• The expected loss from taking action ωi is:

)()()|(

)(x

xx

pPp

P jjj

)()|()(1

jc

jj Ppp

xx

)|()|()|(1

xxx jc

jii PR

Loss Function

)( xjP

Page 13: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 13

• An expected loss is called a risk.

• R(ωi|x) is called the conditional risk.

• A general decision rule is a function α(x) that tells us which action to take for every possible observation.

• The overall risk is given by:

• If we choose α(x) so that R(ωi(x)) is as small as possible for every x, the overall risk will be minimized.

• Compute the conditional risk for every ω and select the action that minimizes R(ωi|x). This is denoted R*, and is referred to as the Bayes risk.

• The Bayes risk is the best performance that can be achieved (for the given data set or problem definition).

xxxx dpRR )()|)((

Bayes Risk

Page 14: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 14

• Let α1 correspond to ω1, α2 to ω2, and λij = λ(αi|ωj)

• The conditional risk is given by:

R(α1|x) = λ11P(ω1|x) + λ12P(ω2|x)

R(α2|x) = λ21P(ω1|x) + ω22P(ω2|x)

• Our decision rule is:

choose ω1 if: R(α1|x) < R(α2|x);otherwise decide ω2

• This results in the equivalent rule:

choose ω1 if: (λ21- λ11) P(x|ω1) > (λ12- λ22) P(x|ω2);

otherwise decide ω2

• If the loss incurred for making an error is greater than that incurred for being correct, the factors (λ21- λ11) and (λ12- λ22) are positive, and the ratio of these factors simply scales the posteriors.

Two-Category Classification

Page 15: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 15

• By employing Bayes formula, we can replace the posteriors by the prior probabilities and conditional densities:

choose ω1 if:(λ21- λ11) p(x|ω1) P(ω1) > (λ12- λ22) p(x|ω2) P(ω2);otherwise decide ω2

• If λ21- λ11 is positive, our rule becomes:

)()(

)|()|(:

1

2

1121

2212

2

11

PP

ppifchoose

xx

• If the loss factors are identical, and the prior probabilities are equal, this reduces to a standard likelihood ratio:

1)|()|(:2

11

xx

ppifchoose

Likelihood

Page 16: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 16

• Consider a symmetrical or zero-one loss function:

cjijiji

ji ,...,2,1,10

)(

• The conditional risk is:

)

)

)

j

jj

x

x

xx

i

c

ij

c

jii

P

P

PRR

(1

(

()()(1

The conditional risk is the average probability of error.

• To minimize error, maximize P(ωi|x) — also known as maximum a posteriori decoding (MAP).

Minimum Error Rate

Page 17: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 17

• Minimum error rate classification: choose ωi if: P(ωi| x) > P(ωj| x) for all j≠i

Likelihood Ratio

Page 18: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 18

• Design our classifier to minimize the worst overall risk(avoid catastrophic failures)

• Factor overall risk into contributions for each region:

xxx

xxx

d|pP|pP

d|pP|pPR

R

R

)]()()()([

)]()()()([

22221121

22121111

2

1

• Using a simplified notation (Van Trees, 1968):

xxxx

xxxx

d|pI;d|pI

d|pI;d|pIPPPP

RR

RR

22

11

)()(

)()()();(

222121

212111

2211

Minimax Criterion

Page 19: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 19

22222212111212211111 IPIPIPIPR

• We can rewrite the risk:

)1()1( 12222212111212221111 IPIPIPIPR

• Note that I11=1-I21 and I22=1-I12:

We make this substitution because we want the risk in terms of error probabilities and priors.

)1)(()(][

)(

21112111222122222211

1112121121121111

1222122222211

1222222221211

2111212221111111211

IPIPPPPIPPIPIPPP

IPPIPPIPIPPPR

• Multiply out, add and subtract P1λ21, and rearrange:

Minimax Criterion

Page 20: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 20

])()()[()1(

)()()[(

)()()[()1)(()1)()(1(

)()1)()(1(

)()1(

21211112221221222

21212111

21211112221221222

21212111211121

21211112221221222

21121121

2111212

122212222222121

2111212

1222122222221

IIPII

IIPII

IIPIIP

IPPPIP

IPPPR

• Note P1 =1- P2:

Expansion of the Risk Function

Page 21: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 21

])()()[()1(

21211112221221222

21212111

IIPIIR

• Note that the risk is linear in P2:

• If we can find a boundary such that the second term is zero, then the minimax risk becomes:

21112111212121112 )()1()( IIIPRmm

• For each value of the prior, there is an associated Bayes error rate.

• Minimax: find the maximum Bayes error for the prior P1, and then use the corresponding decision region.

Explanation of the Risk Function

Page 22: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 22

• Guarantee the total risk is less than some fixed constant (or cost).• Minimize the risk subject to the constraint:

constant)( xx dR i

(e.g., must not misclassify more than 1% of salmon as sea bass)• Typically must adjust boundaries numerically.• For some distributions (e.g., Gaussian), analytical solutions do exist.

Neyman-Pearson Criterion

Page 23: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 23

• Mean:• Covariance:

xxxx )dp(Ε

xxxxxx )dp(]E[ tt )-)-)-)- ((((

• Statistical independence?• Higher-order moments? Occam’s Razor?• Entropy?• Linear combinations of normal random variables?• Central Limit Theorem?

• Recall the definition of a normal distribution (Gaussian):

)]()(21exp[

)2(1)( 1

2/12/

xxx t

dp

• Why is this distribution so important in engineering?

Normal Distributions

Page 24: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 24

• A normal or Gaussian density is a powerful model for modeling continuous-valued feature vectors corrupted by noise due to its analytical tractability.

• Univariate normal distribution:

]21exp[

21)(

2

xxp

dxxpxxE

dxxxpxE

)()()[(

)(][

222

where the mean and covariance are defined by:

• The entropy of a univariate normal distribution is given by:

)2log(

21)(ln)())(( 2edxxpxpxpH

Univariate Normal Distribution

Page 25: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 25

• A normal distribution is completely specified by its mean and variance:

• A normal distribution achieves the maximum entropy of all distributions having a given mean and variance.

• Central Limit Theorem: The sum of a large number of small, independent random variables will lead to a Gaussian distribution.

• The peak is at:

• 66% of the area is within one ; 95% is within two ; 99% is within three .

21)( p

Mean and Variance

Page 26: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 26

• A multivariate distribution is defined as:

)]()(21exp[

)2(1)( 1

2/12/

xxx t

dp

where μ represents the mean (vector) and Σ represents the covariance (matrix).

• Note the exponent term is really a dot product or weighted Euclidean distance.

• The covariance is always symmetric and positive semidefinite.

• How does the shape vary as a function of the covariance?

Multivariate Normal Distributions

Page 27: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 27

• A support region is the obtained by the intersection of a Gaussian distribution with a plane.

• For a horizontal plane, this generates an ellipse whose points are of equal probability density.

• The shape of the support region is defined by the covariance matrix.

Support Regions

Page 28: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 28

Derivation

Page 29: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 29

Identity Covariance

Page 30: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 30

Unequal Variances

Page 31: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 31

Nonzero Off-Diagonal Elements

Page 32: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 32

Unconstrained or “Full” Covariance

Page 33: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 33

• Bayesian decision theory is a fundamental statistical approach to the problem of pattern classification.

• Quantify the tradeoffs between various classification decisions using probability and the costs that accompany these decisions.

• Assume all relevant probability distributions are known (later we will learn how to estimate these from data).

• Can we exploit prior knowledge in our fish classification problem: Are the sequence of fish predictable? (statistics) Is each class equally probable? (uniform priors) What is the cost of an error? (risk, optimization)

Probability Decision Theory

Page 34: LECTURE  02:  BAYESIAN DECISION THEORY

ECE 8527: Lecture 02, Slide 34

Summary• Bayes Formula: factors a posterior into a combination of a likelihood, prior

and the evidence. Is this the only appropriate engineering model?• Bayes Decision Rule: what is its relationship to minimum error?• Bayes Risk: what is its relation to performance?• Generalized Risk: what are some alternate formulations for decision criteria

based on risk? What are some applications where these formulations would be appropriate?