def test_save_and_load_breakdown(self): m = HNodeSimple(self.data) m.sample(500, dbname='test.db', db='pickle') m.save('test.model') m_load = kabuki.utils.load('test.model') os.remove('test.db') os.remove('test.model')
def test_concat(self): n_subj = 5 data, params = kabuki.generate.gen_rand_data(gen_func_df, {'A':{'loc':0, 'scale':1}, 'B': {'loc':0, 'scale':1}}, subjs=n_subj) data = pd.DataFrame(data) models = [] for i in range(4): m = HNodeSimple(data) m.sample(100, burn=0, db='pickle', dbname='test_%d'%i) models.append(m) super_model = kabuki.utils.concat_models(models) stochs = super_model.get_stochastics() for stoch in stochs.node: self.assertEqual(len(stoch.trace[:]), 100*4) for i in range(4): os.remove('test_%d'%i)