def test_tt(self):
     sample, updates = rejection_sample([self.fair_coin,], tensor.eq(tensor.sum(tensor.eq(self.coin, self.data)), 5))
     sampler = theano.function([], sample, updates=updates)
     
     # TODO: this is super-slow, how can bher do this fast?
     for i in range(100):
         print sampler()
Beispiel #2
0
    def test_tt(self):
        sample, updates = rejection_sample([
            self.fair_coin,
        ], tensor.eq(tensor.sum(tensor.eq(self.coin, self.data)), 5))
        sampler = theano.function([], sample, updates=updates)

        # TODO: this is super-slow, how can bher do this fast?
        for i in range(100):
            print sampler()
    def test_rejection_sampler_no_cond(self):
        sample, updates = rejection_sample([self.A, self.B, self.C])

        # create a runnable function
        sampler = theano.function(inputs=[], outputs = sample, updates = updates)

        # generate some data
        data = []
        for i in range(100):
            data.append(sampler())

        # plot histogram
        pylab.hist(numpy.asarray(data))
        pylab.show()
Beispiel #4
0
    def test_rejection_sampler_no_cond(self):
        sample, updates = rejection_sample([self.A, self.B, self.C])

        # create a runnable function
        sampler = theano.function(inputs=[], outputs=sample, updates=updates)

        # generate some data
        data = []
        for i in range(100):
            data.append(sampler())

        # plot histogram
        pylab.hist(numpy.asarray(data))
        pylab.show()