Your question is Writing a Machine Learning Function. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
St. Jude Children's Research Hospital genomic analysis pipelines can model an observed sequence as emissions from hidden biological states. Implement the Viterbi algorithm to return the most likely sequence of hidden state IDs for a Hidden Markov Model.
Implement viterbi_decode(start_probs, transition_probs, emission_probs, observations).
start_probs[i] is the probability that state i starts the sequence.transition_probs[i][j] is the probability of moving from state i to state j.emission_probs[i][k] is the probability that state i emits observation k.observations contains integer observation IDs.Return a list of state IDs, one per observation, with maximum total probability. If multiple paths have the same probability, return the path selected by choosing the smallest predecessor state ID at each tie.
Use log probabilities internally. A probability of 0 represents an impossible transition or emission and must not cause a math-domain error.
def viterbi_decode(start_probs, transition_probs, emission_probs, observations):