Example #1
0
 def test_kl_multiple(self):
     """Check KL divergence between multiple distributions"""
     np.testing.assert_array_equal(
         embo.utils.kl_divergence(self.p_multiple, self.q_multiple),
         spentropy(self.p_multiple, self.q_multiple, base=2))
Example #2
0
 def test_kl(self):
     """Check KL divergence between two single distributions"""
     np.testing.assert_array_equal(
         embo.utils.kl_divergence(self.p, self.q),
         spentropy(self.p, self.q, base=2))
Example #3
0
 def test_entropy_multiple(self):
     """Check entropy for multiple distributions"""
     np.testing.assert_array_equal(
         embo.utils.entropy(self.p_multiple),
         spentropy(self.p_multiple, base=2))
Example #4
0
 def test_entropy_unnormalized(self):
     """Check entropy function on one unnormalized distribution"""
     np.testing.assert_array_equal(
         embo.utils.entropy(self.p_unnormalized),
         spentropy(self.p_unnormalized, base=2))