Cognitive Computer Vision 3R400 Kingsley Sage Room 5C16, Pevensey III
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 ?
Forward evaluation From the previous lecture SunnyRainWet Sunny Rain Wet RedGreenBlue Sunny Rain Wet 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 = Rain 00.00{(0.80*0.3) + (0.00*0.6) + (0.00*0.2)} * 0.8 = Wet 00.00{(0.80*0.1) + (0.00*0.3) + (0.00*0.6)} * 0.2 = 0.016
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}.
Scaling (1) : Arithmetic underflow t=1t=2t=3t=4t=5 Sunny 1/ Rain 1/ Wet 1/ 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
Scaling (2) t=1t=2t=3t=4t=5 Sunny 1/ Rain 1/ Wet 1/ Scaling Factor 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!
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
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
Evaluating the fit between a model and observed data (3) t=1t=2t=3t=4t=5 Scaling Factor 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
Evaluating the fit between a model and observed data (4) t=1t=2t=3t=4t=5 Scaling Factor / SF Average value over all T gives us the measure of the fit between the model and an observation sequence Av/symbol = ( / 5 =
Evaluating the fit between a model and observed data (5) Often expressed as a log value (log likelihood /symbol): LLPS = ln (Av/symbol) = ln(L t ) = 0 Best possible fit ln(L t ) - No fit
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} {red,blue,green} {blue, green, blue, red} NB: The sequences do not need to be the same length
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 …
Backwards evaluation (2) SunnyRainWet Sunny Rain Wet RedGreenBlue Sunny Rain Wet N hidden states M observable states Assume and O = {o 1,o 2, …, o T-1,o T } are given …
Backwards evaluation (3) t=T Sunny1.0 Rain1.0 Wet1.0 SunnyRainWet Sunny Rain Wet RedGreenBlue Sunny Rain Wet N hidden states M observable states time t = T is a special case We don’t know the terminal state …
Backwards evaluation (4) SunnyRainWet Sunny Rain Wet RedGreenBlue Sunny Rain Wet 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) = Rain (1.00*0.1*0.1)+(1.00*0.6*0.8)+(1.00*0.3*0.2) = Wet (1.00*0.2*0.1)+(1.00*0.2*0.8)+(1.00*0.6*0.2) =
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)
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