示例#1
0
def _probability_component_continuous(x, model, col_idx, component_idx):
    hypers = model['col_hypers'][col_idx]
    if component_idx < len(model['col_suffstats'][col_idx]):
        suffstats = model['col_suffstats'][col_idx][component_idx]
    else:
        suffstats = {'n': 0., 'sum_x': 0., 'sum_x_sq': 0.}

    return nng.probability(x, suffstats, hypers)
示例#2
0
def _probability_component_continuous(x, model, col_idx, component_idx):
    hypers = model['col_hypers'][col_idx]
    if component_idx < len(model['col_suffstats'][col_idx]):
        suffstats = model['col_suffstats'][col_idx][component_idx]
    else:
        suffstats = {'n': 0., 'sum_x': 0., 'sum_x_sq': 0.}

    return nng.probability(x, suffstats, hypers)
示例#3
0
def test_probability_values_2(suffstats, hypers):
    log_nng_pp = nng.probability(-3, suffstats, hypers)
    assert log_nng_pp == approx(-6.1637698862186)
示例#4
0
def test_probability_values_1(suffstats, hypers):
    log_nng_pp = nng.probability(3, suffstats, hypers)
    assert log_nng_pp == approx(-1.28438638499611)