def runTest(self): data = self._world.observe(num_samples) p = CBN.from_bn(self._skel.copy(copy_domain=True)) print 'learning from',data.size(),'samples: BDeu score:',p.bdeu_score(data) p.estimate_parameters(data) self.failUnless(same_factor(distribution_of(p), distribution_of(self._skel), dp=2, verbose=True))
def runTest(self): samples = GibbsSampler(self._minibn_do).samples(100000) data = CompactFactor(samples,domain=Domain()) p = self._minibn_do.copy(copy_domain=True) p.estimate_parameters(data) self.failUnless(same_factor(distribution_of(p), distribution_of(self._minibn_do), dp=2, verbose=True))
def runTest(self): data = self._world.query(self._intervention, num_samples) p = self._query.copy(copy_domain=True) print 'learning from',data.size(),'samples: BDeu score:',p.bdeu_score(data) p.estimate_parameters(data) self.failUnless(same_factor(distribution_of(p), distribution_of(self._query), dp=2, verbose=True))