Beispiel #1
0
def test_calc_p_sum():
    for estimator in ESTIMATORS:
        calc_p = ctw._Contexted(estimator).calc_p
        def p_func(seq):
            return calc_p("", seq)

        _check_p_sum(p_func)
def test_calc_p_sum():
    for estimator in ESTIMATORS:
        calc_p = ctw._Contexted(estimator).calc_p
        def p_func(seq):
            return calc_p("", seq)

        _check_p_sum(p_func)
Beispiel #3
0
def test_calc_p():
    for estimator in ESTIMATORS:
        calc_p = ctw._Contexted(estimator).calc_p
        eq_(calc_p("", ""), 1.0)
        eq_(calc_p("", "0"), 0.5)
        eq_(calc_p("", "1"), 0.5)
        eq_(calc_p("", "01"), calc_p("", "10"))
        eq_(calc_p("", "11"), calc_p("", "00"))
def test_calc_p():
    for estimator in ESTIMATORS:
        calc_p = ctw._Contexted(estimator).calc_p
        eq_(calc_p("", ""), 1.0)
        eq_(calc_p("", "0"), 0.5)
        eq_(calc_p("", "1"), 0.5)
        eq_(calc_p("", "01"), calc_p("", "10"))
        eq_(calc_p("", "11"), calc_p("", "00"))
Beispiel #5
0
def test_see():
    contexted =naive_ctw._Contexted(naive_ctw._estim_kt_p)
    for seq in iter_all_seqs(seq_len=10):
        model = ctw.create_model()
        model.see_generated(to_bits(seq))
        eq_float_(_get_history_p(model), contexted.calc_p("", seq))
Beispiel #6
0
def test_see():
    contexted = naive_ctw._Contexted(naive_ctw._estim_kt_p)
    for seq in iter_all_seqs(seq_len=10):
        model = ctw.create_model()
        model.see_generated(to_bits(seq))
        eq_float_(_get_history_p(model), contexted.calc_p("", seq))