3th, laboratory session ----------------------- Hidden Markov Models In class: understand the format of the file .hmm For one dice: ------- fair.hmm (only one state with 6 values) M= 6 N= 1 A: 1 B: 0.167 0.167 0.167 0.167 0.166 0.166 pi: 1 ------- For two dice, one fair and the other loaded, and after ten rolls the dice is changed (two states with 6 simbols) -------dishonest.hmm M= 6 N= 2 A: 0.9 0.1 0.1 0.9 B: 0.167 0.167 0.167 0.167 0.166 0.166 0.1 0.1 0.1 0.1 0.1 0.5 pi: 0.5 0.5 ------- 1. genseq creates a sequence of rolls: >genseq -T 5000 fair.hmm For instance, 5000 values under the fair.hmm model. 2. testvit: given a sequence and a model estimates the most probable sequence of states >testvit loaded.hmm filewithsequence 3. esthmm: estimates the most probable model >esthmm -N num_estat -M num_values file with sequence The validity of the results depends on the length of the sequence. WORKHOME: 1 - genseq gives the sequence of values. Change the code to obtain also the sequence of states. 2 - with this new genseq creates some sequences of rolls, and with testvit estimates, for every sequence, the most probable states. Then calculate the percentage of success. Answer the following questions from experimental data: a) I guess that HMM detect the state changes only if the new state is enough large? b) and this detection has a delay, i.e., is detected some charactes beyond the first one of the new state. 3 - Creates a sequence of rolls with a new model of two or three dice. Then with esthmm try to estimate the model. Answer the following questions from experimental data: a) is the length of the sequence of rolls a determinant factor for the success? 3a sessio de laboratori ----------------------- (Feu la versio en angles) Hidden Markov Models A classe: - Entendre el format del fitxer .hmm D'un dau: ------- fair.hmm (un estat 6 simbols) M= 6 N= 1 A: 1 B: 0.167 0.167 0.167 0.167 0.166 0.166 pi: 1 ------- De dos daus, un equilibrat i l'altre trucat i cada 10 tirades canvia de dau (dos estats 6 simbols) -------dishonest.hmm M= 6 N= 2 A: 0.9 0.1 0.1 0.9 B: 0.167 0.167 0.167 0.167 0.166 0.166 0.1 0.1 0.1 0.1 0.1 0.5 pi: 0.5 0.5 ------- 1. Generar una sequencia de valors amb genseq: >genseq -T 5000 fair.hmm genereu una sequencia de 5000 valors segons el model fair.hmm 2. Estimar els estats a partir del model i una sequencia de valors >testvit loaded.hmm fitxeramblasequencia 3. Si es desconeix el model amb el que s'ha generat una sequencia podem intentar deduir-lo amb el programa esthmm fent >esthmm -N num_estat -M num_simbols fitxeramblasequencia on la correccio dels resultats depene de la llargada de la sequencia. FEINA: 1 - Generar sequencies de valors i estats amb genseq modificat: agafeu el model del casino deshonest i modifiqueu el programa genseq.c per tal que tambe escrigui l'estat que ha generat cada valor. 2 - calculeu el percentatge dels estats estimats per testvit que coincideixen amb els anotats per genseq. 4 - Genereu un sequencia amb un model de dos o mes daus (per comoditat) i comproveu si esthmm dedueix correctament les distribucions. Heu de suposar que no sabeu res del model, ni tan sols el numero de daus. Quina relacio hi ha entre la correccio del model estimat i la llargada de la sequencia de que es disposa.