def setUp(self): self.net = network.Network( [data.DiscreteVariable(i,3) for i in xrange(5)], "0,1;3,2;2,4;1,4" ) self.p = prior.UniformPrior(len(self.net.nodes)) self.p2 = prior.UniformPrior(len(self.net.nodes), weight=2.0)
def test_null_prior(): net = network.Network( [data.DiscreteVariable(i,3) for i in xrange(5)], "0,1;3,2;2,4;1,4" ) p1 = prior.NullPrior() assert p1.loglikelihood(net) == 0.0 net.edges.add((1,4)) assert p1.loglikelihood(net) == 0.0
def setUp(self): self.net = network.Network( [data.DiscreteVariable(i,3) for i in xrange(5)], "0,1;1,3;1,2" ) energymat = N.array([[ 0.5, 0. , 0.5, 0.5, 0.5], [ 0.5, 0.5, 0.5, 0.5, 0. ], [ 0.5, 0.5, 0.5, 0.5, 0.5], [ 0.5, 0.5, 0.5, 0.5, 5. ], [ 0.5, 0.5, 0.5, 0.5, 0.5]]) self.p = prior.Prior(len(self.net.nodes), energymat, required_edges=[(1,2)])
def setUp(self): self.net = network.Network( [data.DiscreteVariable(i,3) for i in xrange(5)], "0,1;3,2;2,4;1,4" ) self.p = prior.Prior( len(self.net.nodes), required_edges=[(1,4),(0,1)], prohibited_edges=[(3,4)], constraints=[lambda am: not am[0,4]] )
def setUp(self): self.nodes = [data.DiscreteVariable(str(i), 3) for i in xrange(6)]
def setUp(self): self.net = network.Network( [data.DiscreteVariable(str(i), 3) for i in xrange(6)], "0,1;4,5;2,3")
def setUp(self): self.net = network.Network( [data.DiscreteVariable(str(i), 3) for i in xrange(6)], [(0, 1), (4, 5), (2, 3)])
def setUp(self): self.net = network.Network( [data.DiscreteVariable(i, 3) for i in xrange(6)]) for edge in [(0, 1), (0, 3), (1, 2)]: self.net.edges.add(edge)