def test_backward_probability():
    from numpy.testing import assert_array_almost_equal

    model, states, symbols, seq = _wikipedia_example_hmm()

    bp = 2**model._backward_probability(seq)
    # examples in wikipedia are normalized

    bp = (bp.sum(axis=1) / bp.T).T

    wikipedia_results = [
        # Forward-backward algorithm doesn't need b0_5,
        # so .backward_probability doesn't compute it.
        # [0.6469, 0.3531],
        [0.5923, 0.4077],
        [0.3763, 0.6237],
        [0.6533, 0.3467],
        [0.6273, 0.3727],
        [0.5, 0.5],
    ]

    assert_array_almost_equal(wikipedia_results, bp, 4)
dataset/ETHPy150Open nltk/nltk/nltk/test/unit/test_hmm.py/test_backward_probability/swapped operands of `/`