Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the DTMC below: Let A = {s_3} and B = {S_2). Compute the probability me

ID: 3804266 • Letter: C

Question

Consider the DTMC below: Let A = {s_3} and B = {S_2). Compute the probability measure of the union of the following cylinder sets: Cyl (s_os_1), Cyl(s_os_5s_6), Cyl (s_os_5s_4s_3), Cyl (s_os_1s_6) Compute the probability, from each state of the Markov chain, of reaching a state in A within 4 steps. Compute the probability, from each state of the Markov chain, of reaching a state in A. What is the probability, from the initial state, of reaching the set of states A U B? What is the probability, from the initial state, that a state from A U B is visited infinitely often?

Explanation / Answer

import java.text.*;

/** This category implements a Hidden Markov Model, as well as
the Baum-Welch algorithmic program for coaching HMMs.
@author Holger Wunsch (wunsch@sfs.nphil.uni-tuebingen.de)
*/
public category HMM variety of states */
public int numStates;

/** size of output vocabulary */
public int sigmaSize;

/** initial state chances */
public double pi[];

/** transition chances */
public double a[][];

/** emission chances */
public double b[][];

/** initializes associate HMM.
@param numStates range of states
@param sigmaSize size of output vocabulary
*/
public HMM(int numStates, int sigmaSize)

/** implementation of the Baum-Welch algorithmic program for HMMs.
@param o the coaching set
@param steps the quantity of steps
*/
public void train(int[] o, int steps) {
int T = o.length;
double[][] fwd;
double[][] bwd;

double pi1[] = new double[numStates];
double a1[][] = new double[numStates][numStates];
double b1[][] = new double[numStates][sigmaSize];

for (int s = 0; s < steps; s++) {
/* calculation of Forward- und Backward Variables from the
   current model */
fwd = forwardProc(o);
bwd = backwardProc(o);

/* re-estimation of initial state chances */
for (int i = 0; i < numStates; i++)
   pi1[i] = gamma(i, 0, o, fwd, bwd);

/* re-estimation of transition chances */
for (int i = 0; i < numStates; i++)
   a1[i][j] = divide(num, denom);
   }
}
  
/* re-estimation of emission chances */
for (int i = 0; i < numStates; i++) one : 0);
   denom += g;
   }
   b1[i][k] = divide(num, denom);
   }
}
pi = pi1;
a = a1;
b = b1;
}
}
  

/** calculation of Forward-Variables f(i,t) for state i at time
t for output sequence O with the present HMM parameters
@param o the output sequence O
@return associate array f(i,t) over states and times, containing
the Forward-variables.
*/
public double[][] forwardProc(int[] o) format (time 0) */
for (int i = 0; i < numStates; i++)
fwd[i][0] = pi[i] * b[i][o[0]];

/* induction */
for (int t = 0; t <= T-2; t++)
}

come back fwd;
}

/** calculation of Backward-Variables b(i,t) for state i at time
t for output sequence O with the present HMM parameters
@param o the output sequence O
@return associate array b(i,t) over states and times, containing
the Backward-Variables.
*/
public double[][] backwardProc(int[] o) low-level formatting (time 0) */
for (int i = 0; i < numStates; i++)
bwd[i][T-1] = 1;

/* induction */
for (int t = T - 2; t >= 0; t--)
}

come back bwd;
}

/** calculation of chance P(X_t = s_i, X_t+1 = s_j | O, m).
@param t time t
@param i the quantity of state s_i
@param j the quantity of state s_j
@param o associate output sequence o
@param fwd the Forward-Variables for o
@param bwd the Backward-Variables for o
@return P
*/
public double p(int t, int i, int j, int[] o, double[][] fwd, double[][] bwd) {
double num;
if (t == o.length - 1)
num = fwd[i][t] * a[i][j];
else
num = fwd[i][t] * a[i][j] * b[j][o[t+1]] * bwd[j][t+1];

double denom = 0;

for (int k = 0; k < numStates; k++)
denom += (fwd[k][t] * bwd[k][t]);

come back divide(num, denom);
}

/** computes gamma(i, t) */
public double gamma(int i, int t, int[] o, double[][] fwd, double[][] bwd) {
double num = fwd[i][t] * bwd[i][t];
double denom = 0;

for (int j = 0; j < numStates; j++)
denom += fwd[j][t] * bwd[j][t];

come back divide(num, denom);
}

/** prints all the parameters of associate HMM */
public void print()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote