himamo v0.1.0 Himamo.BaumWelch.StepE

Defines components of the E-step of the Baum-Welch algorithm (Expectation).

Calculates required statistics for the given model.

Summary

Functions

Computes alpha variable for Baum-Welch

Computes a Matrix where each element is alpha_{t, i} * beta_{t, i}

Computes beta variable for Baum-Welch

Computes gamma variable for Baum-Welch

Computes xi variable for Baum-Welch

Functions

compute_alpha(model, obs_seq)

Computes alpha variable for Baum-Welch.

α_t(i) is the probability of being in state S_i at time t after observing the first t symbols.

Returns tuple of tuples (size T×N) where:

  • T - length of observation sequence
  • N - number of states in the model
compute_alpha_times_beta(alpha, beta)

Specs

compute_alpha_times_beta(Himamo.Matrix.t, Himamo.Matrix.t) :: Himamo.Matrix.t

Computes a Matrix where each element is alpha_{t, i} * beta_{t, i}.

This is not matrix multiplication. The result of the above expression is used in multiple places, so the values are computed up front.

compute_beta(model, obs_seq)

Computes beta variable for Baum-Welch.

ß_t(i) is the probability of being in state S_i at time t and observing the partial sequence from t+1 to the end.

Returns tuple of tuples (size T×N) where:

  • T - length of observation sequence
  • N - number of states in the model
compute_gamma(model, obs_seq, list)

Specs

Computes gamma variable for Baum-Welch.

γ_t(i) is the probability of being in state S_i at time t given the full observation sequence.

Returns tuple of tuples (size T×N) where:

  • T - length of observation sequence
  • N - number of states in the model
compute_xi(model, obs_seq, list)

Computes xi variable for Baum-Welch.

ξ_t(i,j) is the probability of being in state S_i at time t and in state S_j at time t+1 given the full observation sequence.

Returns tuple of tuples of tuples (size T×N×N) where:

  • T - length of observation sequence
  • N - number of states in the model