Exemple #1
0
 def test_true_kldiv(self):
     f = eKLdiv(self.x, self.y, 3000000)
     g = true_kldiv(self.mux, self.muy, self.sigx, self.sigy)
     self.assertAlmostEqual(
         f,
         g,
         2,
         'failed to generate similar answers, f:%f, g:%f' % (f, g))
Exemple #2
0
 def test_random_true_kldiv(self):
     y = self.y + np.random.uniform(-1, 1, 3)
     f = eKLdiv(self.x, y, 3000000)
     g = true_kldiv(self.mux, y.mus[0], self.sigx, y.sigmas[0])
     self.assertAlmostEqual(
         f,
         g,
         2,
         'failed to generate similar answers, f:%f, g:%f' % (f, g))
Exemple #3
0
 def testRandomTrueKLdiv(self):
     y = self.y + np.random.uniform(-1, 1, 3)
     f = eKLdiv(self.x, y, 3000000)
     g = true_kldiv(self.mux, y.mus[0], self.sigx, y.sigmas[0])
     self.assertAlmostEqual(
         f, g, 2, 'fialed to generate simialr ansers, f:%f, g:%f' % (f, g))
Exemple #4
0
 def testTrueKLdiv(self):
     f = eKLdiv(self.x, self.y, 3000000)
     g = true_kldiv(self.mux, self.muy, self.sigx, self.sigy)
     self.assertAlmostEqual(
         f, g, 2, 'fialed to generate simialr ansers, f:%f, g:%f' % (f, g))