def test_get_stationary_distribution_full_matrix(self): transition_matrix = np.array( [[0.6, 0.1, 0.3], [0.1, 0.7, 0.2], [0.2, 0.2, 0.6]], dtype=float) expected = np.array([0.2759, 0.3448, 0.3793]) computed = utils.get_stationary_distribution( transition_matrix, aperiodic_irreducible_eps=0.0) np.testing.assert_array_almost_equal(expected, computed, decimal=4)
def test_get_stationary_distribution(self): transition_matrix = np.array( [[0, 0, 0], [0.9, 0, 0.1], [0.25, 0, 0.75]], dtype=float) expected = np.array([0.3571, 0.1191, 0.5238]) computed = utils.get_stationary_distribution( transition_matrix, aperiodic_irreducible_eps=0.0001) np.testing.assert_array_almost_equal(expected, computed, decimal=4)
def test_get_stationary_distribution_simple(self): transition_matrix = np.array([[0, 0, 1], [0, 0, 1], [0, 0, 1]], dtype=float) expected = np.array([0, 0, 1]) computed = utils.get_stationary_distribution( transition_matrix, aperiodic_irreducible_eps=0.0) np.testing.assert_array_almost_equal(expected, computed, decimal=4)