def test_step_categorical(self): start, model, (mu, C) = simple_categorical() unc = C ** 0.5 check = (("x", np.mean, mu, unc / 10.0), ("x", np.std, unc, unc / 10.0)) with model: steps = ( CategoricalGibbsMetropolis(model.x, proposal="uniform"), CategoricalGibbsMetropolis(model.x, proposal="proportional"), ) for step in steps: trace = sample(8000, tune=0, step=step, start=start, model=model, random_seed=1) self.check_stat(check, trace, step.__class__.__name__)
def test_step_categorical(self): start, model, (mu, C) = simple_categorical() unc = C ** .5 check = (('x', np.mean, mu, unc / 10.), ('x', np.std, unc, unc / 10.)) with model: steps = ( CategoricalGibbsMetropolis(model.x, proposal='uniform'), CategoricalGibbsMetropolis(model.x, proposal='proportional'), ) for step in steps: trace = sample(8000, step=step, start=start, model=model, random_seed=1) yield self.check_stat, check, trace, step.__class__.__name__