ECE53 Homework Assignment Number 2 Due by 8:5pm on Thursday 5-Feb-29 Make sure your reasoning and work are clear to receive full credit for each problem 3 points A city has two taxi companies distinguished by the color of their taxis: 85% of the taxis are Yellow and the rest are Blue A taxi was involved in a hit and run accident and was witnessed by Mr Green Unfortunately, Mr Green is mildly color blind and can only correctly identify the color 8% of the time In the trial, Mr Green testified that the color of the taxi was blue Should you trust him? Solution: This problem can be interpreted as: Does Mr Green s decision minimizes the Bayesian risk? Let s assume a uniform cost assignment (UCA) and use x and H to represent Yellow and x and H to represent Blue Also let = 85 denote the prior probability of a yellow taxi, = 5 denote the prior probability of a blue taxi, and Y = y denote Mr Green s observation of a blue taxi Then from slide 26 in Lecture 2b, a deterministic Bayes decision rule can be written in terms of the posterior probabilities as δ B (y) = arg max j (y), i {,} x j H i where j (y) = Prob(state is x j observation is y) Given Mr Green s observation Y = y (the taxi was blue), then if (y ) > (y ) the posterior probability of the taxi being blue is greater than the posterior probability of the taxi being yellow and we can trust MrGreen We can write the posterior probabilities (y ) = p (y ) p(y ) (y ) = p (y ) p(y ) Thus we only need to compare κ = p (y ) and κ = p (y ) κ = 2 85 = 7 κ = 8 5 = 2 We see that κ > κ, hence the posterior probability of the taxi being yellow is greater than the posterior probability of the taxi being blue and we can not trust MrGreen 2 8 points total Consider the coin flipping problem where you have an unknown coin, either fair (HT) or double headed (HH), and you observe the outcome of n flips of this coin Assume a uniform cost assignment For notational consistency, let the state and hypothesis x and H be the case when the coin is HT and x and H be the case when the coin is HH
(a) 3 points Plot the conditional risk vectors (CRVs) of the deterministic decision rules for the cases of n =,2,3,4, coin flips You might want to write a Matlab script to do this for n > 2 Solution: See the Matlab script and plots below % 2 % ECE53 Spring 29 3 % DRB 5 Feb 29 4 % Solution to Homework 2 Problem 2 part a 5 % 6 % USER PARAMETERS BELOW 7 % 8 ntest = :4; % values of n to test 9 % N = 2; % number of hypotheses 2 M = 2; % number of states 3 p H = 5; % conditional p robability of H given x 4 p H = ; % conditional p robability of H given x 5 C = [ ; ] ; % UCA 6 7 for n = ntest 8 9 L = n+; % number of possible observations 2 totd = MˆL; % total number of decision matrices 2 B = makebinary (L, ) ; 22 23 % form conditional probability matrix 24 % columns are indexed by state 25 % rows are indexed by observation 26 P = zeros (L, ) ; 27 P = zeros (L, ) ; 28 for i = :( L ), 29 P( i +) = nchoosek (n, i ) p Hˆ i ( p H )ˆ(n i ) ; 3 P( i +) = nchoosek (n, i ) p Hˆ i ( p H )ˆ(n i ) ; 3 end 32 P = [P P ] ; 33 34 % compute CRVs for a l l possible deterministic decision matrices 35 for i = :( totd ), 36 D = [ B( :, i +) ; B( :, i +) ] ; % decision matrix 37 % compute risk vectors 38 for j =:, 39 R( j +, i +) = C( :, j +) D P( :, j +); 4 end 4 end 42 43 fi gure 44 plot (R(,:),R( 2,:), p ) ; 45 xlabel ( R ) 46 ylabel ( R ) 47 title ( [ n= num2str(n ) ] ) ; 48 axis square 49 grid on 5 5 end Here is the function makebinarym that is called by the main code function y=makebinary (K, unipolar ) 2
3 y=zeros (K,2ˆK) ; % a l l possible b it combos 4 for index =:K, 5 y(k index +,:)=( )ˆ ceil ( [:2ˆK]/(2ˆ( index ))); 6 end 7 if unipolar >, 8 y = (y+)/2; 9 end Here are the plots n= 9 8 7 6 R 5 4 3 2 2 3 4 5 6 7 8 9 R
n=2 9 8 7 6 R 5 4 3 2 2 3 4 5 6 7 8 9 R n=3 9 8 7 6 R 5 4 3 2 2 3 4 5 6 7 8 9 R
n=4 9 8 7 6 R 5 4 3 2 2 3 4 5 6 7 8 9 R (b) 2 points What can you say about the convex hull of the deterministic CRVs as n increases? Solution: You can see the trend from the plots of how the CRVs of the deterministic decision rules move closer to the bottom left corner as n increases The convex hull of achievable CRVs then fills more of the risk plane as n gets larger Hence, you can achieve any arbitrarily small risk combination for sufficiently large n (c) 3 points When n = 2, find the deterministic decision rule(s) that minimize the Bayes risk for the prior = 6 and = 4 Repeat this for the case when n = 3 Does the additional observation reduce the Bayes risk for this prior? Solution: Notation: HT = x H and HH = x H When n=2, we can write the conditional probability matrix P as and the expected cost matrix G as [ G = P = 25 5 25 4 5 3 5 Hence the optimal deterministic decision matrix that minimizes the Bayes cost is [ ] D = and the resulting Bayes risk is r = 5 ]
When n=3, we can write the conditional probability matrix P as 25 P = 375 375 25 and the expected cost matrix G as [ ] 4 G = 75 225 225 75 Hence the optimal deterministic decision matrix that minimizes the Bayes cost is [ ] D = and the resulting Bayes risk is r = 75 The risk is reduced by flipping the coin one more time, as you would expect 3 3 points Poor textbook Chapter II Problem 2 (a) Solution: The likelihood ratio is given by L(y) = p (y) p (y) = 3 2(y + ), y With uniform costs and equal priors, we can compute the optimum threshold on the likelihood function as τ = From our expression for L(y), an equivalent condition to L(y) is y [,5] Thus, for priors = = 5, the deterministic Bayes decision rule is given by if y < 5 δ B (y) = / if y = 5 if 5 < y The corresponding minimum Bayes risk for this prior is 5 r(δ B 2 ) = 5 (y + )dy + 5 dy = 3 5 24 4 3 points Poor textbook Chapter II, Problem 4 (a) Solution: Here the likelihood ratio is given by L(y) = p (y) 2 p (y) = y 2 ey Let 2 τ = and note that L(y) = τ is equivalent to y = τ where ( ) τ = 2ln 2e 2e (y ) 2 e 2, y
Hence, we can express the critical region of observations where we decide H as Γ = { y (y ) 2 τ } There are three cases that depend on τ : if τ < Γ = [ τ, + ] τ if τ [, + ] τ if τ > For notational convenience, let s define the following constants: Then we can say that α := + β := + 2e 2e 2 2 5683 44379 The condition τ < is equivalent to α < The condition τ is equivalent to β α The condition τ > is equivalent to < β The minimum Bayes risk V ( ) can be calculated according to these three regions: if α < [ + τ V ( ) = e y 2 τ dy + ( τ ) e y 2 2 dy + ] + τ e y 2 2 dy if β α + τ e y 2 dy + ( ) + τ e y 2 2 dy if < β Note that these integrals can be expressed as Q-functions (or erf/erfc functions) but cannot be evaluated in closed form for arbitrary priors 5 3 points Poor textbook Chapter II, Problem 6 (a) Solution: Here we have p (y) = p N (y + s) and p (y) = p N (y s), where p N (x) is the pdf of the random variable N This gives the likelihood function L(y) = + (y + s)2 + (y s) 2 With equal priors and uniform costs, the critical region where we decide H is Γ = {L(y) } = { + (y + s) 2 + (y s) 2} = {2sy 2sy} = [, ) Thus, the Bayes decision rule reduces to { δ B if y (y) = if y < The minimum Bayes risk is then r(δ B ) = 2 [ + (y + s) 2 ] dy + 2 [ + (y s) 2 ] dy = 2 tan (s)