All problems
Markov-Switching Smoothed Probability
Problem
Update regime probabilities with one observation. Starting from filtered_probs, propagate through the transition matrix, multiply elementwise by the emission likelihoods, and normalize to sum to 1.
Return the updated probability vector; when the total is zero return the filtered probabilities unchanged.
Hint
The transition step spreads probability before the observation reweights the states.
Test cases
case 1
in: [[0.6,0.4],[[0.9,0.1],[0.2,0.8]],[0.7,0.3]]
expected: [0.7919708029197081,0.208029197080292]
case 2
in: [[1,0],[[0.9,0.1],[0.2,0.8]],[0.5,0.5]]
expected: [0.9,0.1]
case 3
in: [[0.5,0.5],[[0.5,0.5],[0.5,0.5]],[1,1]]
expected: [0.5,0.5]
case 4
in: [[0,0],[[0.5,0.5],[0.5,0.5]],[1,1]]
expected: [0,0]
Starter codePython
def markov_switching_smoothed_probability(filtered_probs, transition_matrix, emission_probs):
# Your code here
pass4 test cases · run your code against them in the editor