Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cognitive Computer Vision 3R400 Kingsley Sage Room 5C16, Pevensey III

Similar presentations


Presentation on theme: "Cognitive Computer Vision 3R400 Kingsley Sage Room 5C16, Pevensey III"— Presentation transcript:

1 Cognitive Computer Vision 3R400 Kingsley Sage Room 5C16, Pevensey III khs20@sussex.ac.uk

2 Markov Models - Seminar Practical issues in computing a forward evaluation matrix – The prior state assumption – Scaling Evaluating the fit between a model and observed data Backwards evaluation – What is it ? – Why do we need it ?

3 Forward evaluation From the previous lecture SunnyRainWet Sunny 0.60.30.1 Rain 0.10.60.3 Wet 0.2 0.6 RedGreenBlue Sunny0.80.1 Rain0.10.80.1 Wet0.2 0.6 N hidden states M observable states Here O = {o 1 = red, o 2 = green}  t=1t=2 Sunny 10.80{(0.80*0.6) + (0.00*0.1) + (0.00*0.2)} * 0.1 = 0.048 Rain 00.00{(0.80*0.3) + (0.00*0.6) + (0.00*0.2)} * 0.8 = 0.192 Wet 00.00{(0.80*0.1) + (0.00*0.3) + (0.00*0.6)} * 0.2 = 0.016

4 The prior state of the model  Sunny1.0 Rain0.0 Wet0.0 That’s OK if we know the hidden structure of our model and what state it was in at t = 0, but this is not always the case. If we have no other prior knowledge we assume a uniform prior at t = 0 …  = {1/N,1/N,1/N} where N is # of hidden states Here  = {1,0,0}.

5 Scaling (1) : Arithmetic underflow  t=1t=2t=3t=4t=5 Sunny 1/30.26670.01770.00230.00080.0025 Rain 1/30.03330.09070.05020.00320.0005 Wet 1/30.06670.01530.00760.01190.0016 O = {o 1 = red, o 2 = green, o 3 = green, o 4 = blue, o 5 = red} Problem: co-efficients  0 geometrically as t increases. For long sequences this can give rise to arithmetic underflow

6 Scaling (2)  t=1t=2t=3t=4t=5 Sunny 1/30.72730.14290.03780.04960.5484 Rain 1/30.09090.73320.83520.20280.0983 Wet 1/30.18180.12400.12700.74760.3534 Scaling Factor 2.72732.96502.05703.76983.4348 Solution: Normalise each column so that it sums to 1 before continuing onto the next column of the forward evaluation. Each column then has a scaling factor SF t Need to think about what this means for the probability values!

7 Evaluating the fit between a model and observed data (1) Given any HMM = ( , A, B), we want to be able to measure how well describes an arbitrary observation sequence O. Forward evaluation is the mechanism, but what is the quantative measure?  Likelihood per symbol

8 Evaluating the fit between a model and observed data (2) i.e. the probability associated with any discrete observation symbol o t is the sum of the trellis column at time t p(o t ) gives us a measure of how the model fits on account of o t

9 Evaluating the fit between a model and observed data (3)  t=1t=2t=3t=4t=5 Scaling Factor 2.72732.96502.05703.76983.4348 Likelihood L t = 1 / SF t gives us a measure of fit between o t and the model assuming normalisation at step t-1, I.e. that all steps have equal importance: L t = 1  Best possible fit L t  0  No fit

10 Evaluating the fit between a model and observed data (4)  t=1t=2t=3t=4t=5 Scaling Factor 2.72732.96502.05703.76983.4348 1 / SF 0.36670.33730.48610.26530.2911 Average value over all T gives us the measure of the fit between the model and an observation sequence Av/symbol = (0.3667+0.3373+0.4861+0.2653+0.2911 / 5 = 0.3493

11 Evaluating the fit between a model and observed data (5) Often expressed as a log value (log likelihood /symbol): LLPS = ln (Av/symbol) = -1.0518 ln(L t ) = 0  Best possible fit ln(L t )  -  No fit

12 Evaluating the fit between a model and observed data (6) So we can use the LLPS measure to “score” observations sequences. The workings are left as a practical exercise. OAv / SymLLPS {red,red,red} 0.2623-1.3382 {red,blue,green} 0.1827-1.6997 {blue, green, blue, red} 0.2371-1.4392 NB: The sequences do not need to be the same length

13 Backwards evaluation (1) Similar process to forward evaluation except that instead of  relating to state of model at time t = 0, it refers to the state of the model at time t = T, and we work our trellis calculations in the other direction Let’s see this in action …

14 Backwards evaluation (2) SunnyRainWet Sunny 0.60.30.1 Rain 0.10.60.3 Wet 0.2 0.6 RedGreenBlue Sunny0.80.1 Rain0.10.80.1 Wet0.2 0.6 N hidden states M observable states Assume and O = {o 1,o 2, …, o T-1,o T } are given …

15 Backwards evaluation (3) t=T Sunny1.0 Rain1.0 Wet1.0 SunnyRainWet Sunny 0.60.30.1 Rain 0.10.60.3 Wet 0.2 0.6 RedGreenBlue Sunny0.80.1 Rain0.10.80.1 Wet0.2 0.6 N hidden states M observable states time t = T is a special case We don’t know the terminal state …

16 Backwards evaluation (4) SunnyRainWet Sunny 0.60.30.1 Rain 0.10.60.3 Wet 0.2 0.6 RedGreenBlue Sunny0.80.1 Rain0.10.80.1 Wet0.2 0.6 N hidden states M observable states Here O = {…, o T = green} t = T-1t=T Sunny (1.00*0.6*0.1)+(1.00*0.3*0.8)+(1.00*0.1*0.2) =0.32 1.00 Rain (1.00*0.1*0.1)+(1.00*0.6*0.8)+(1.00*0.3*0.2) =0.55 1.00 Wet (1.00*0.2*0.1)+(1.00*0.2*0.8)+(1.00*0.6*0.2) =0.30 1.00

17 Backwards evaluation (5) Can calculate p(O| ) just like forward evaluation Same scaling tricks apply Why do we need it then? – Combine with forward evaluation to create a technique for learning model parameters – The forward-backwards algorithm / Baum Welch learning (next lecture)

18 Coursework Investigating forwards and backwards evaluation and measures of model fit Need to write code or perform manual calculations, carry out specified experiments and write up a short report Due


Download ppt "Cognitive Computer Vision 3R400 Kingsley Sage Room 5C16, Pevensey III"

Similar presentations


Ads by Google