diff --git a/nifty5/__init__.py b/nifty5/__init__.py index 30f7d5b41c647e481537150f198a3f8bd67f4978..b27fc9a0b28686f1c6800f624c5075f4c5ea5816 100644 --- a/nifty5/__init__.py +++ b/nifty5/__init__.py @@ -49,7 +49,7 @@ from .operators.simple_linear_operators import ( FieldAdapter, ducktape, GeometryRemover, NullOperator) from .operators.energy_operators import ( EnergyOperator, GaussianEnergy, PoissonianEnergy, InverseGammaLikelihood, - BernoulliEnergy, Hamiltonian, SampledKullbachLeiblerDivergence) + BernoulliEnergy, Hamiltonian, AveragedEnergy) from .probing import probe_with_posterior_samples, probe_diagonal, \ StatCalculator diff --git a/nifty5/operators/energy_operators.py b/nifty5/operators/energy_operators.py index 41e7d696c0c76ab47925a3f598aa2e578bdc327d..4bbf4828a0fc79377e785631f7820b5b41af010e 100644 --- a/nifty5/operators/energy_operators.py +++ b/nifty5/operators/energy_operators.py @@ -300,8 +300,8 @@ class Hamiltonian(EnergyOperator): return 'Hamiltonian:\n' + utilities.indent(subs) -class SampledKullbachLeiblerDivergence(EnergyOperator): - """Class for Kullbach Leibler (KL) Divergence or Gibbs free energies +class AveragedEnergy(EnergyOperator): + """Class for Kullbach-Leibler (KL) Divergence or Gibbs free energies Precisely a sample averaged Hamiltonian (or other energy) that represents approximatively the relevant part of a KL to be used in Variational Bayes @@ -320,7 +320,7 @@ class SampledKullbachLeiblerDivergence(EnergyOperator): in essence the information Hamiltonian averaged over a Gaussian distribution centered on the mean m. - SampledKullbachLeiblerDivergence(H) approximates + AveragedEnergy(H) approximates :math:\\left< H(f) \\right>_{G(f-m,D)} if the residuals :math:f-m are drawn from covariance :math:D. @@ -334,7 +334,7 @@ class SampledKullbachLeiblerDivergence(EnergyOperator): Notes ----- - KL = SampledKullbachLeiblerDivergence(H, samples) represents + KL = AveragedEnergy(H, samples) represents :math:\\text{KL}(m) = \\sum_i H(m+v_i) / N, diff --git a/nifty5/operators/operator.py b/nifty5/operators/operator.py index 612b978e198d86b5473f3fe6402cc12dbd32dd55..780d37f0130ac9a2a3c1b9a2e2bfe857656af181 100644 --- a/nifty5/operators/operator.py +++ b/nifty5/operators/operator.py @@ -107,7 +107,7 @@ class Operator(NiftyMetaBase()): Parameters ---------- - x : Field/Multifield + x : Field or MultiField the operator's input """ raise NotImplementedError diff --git a/test/test_energy_gradients.py b/test/test_energy_gradients.py index 9cbe7105769c9e8f39f26eb3a54b8c20fb674ac0..6541f0aaae8d03b3bad8446896fdd0684ffa4de9 100644 --- a/test/test_energy_gradients.py +++ b/test/test_energy_gradients.py @@ -73,7 +73,7 @@ def test_hamiltonian_and_KL(field): ift.extra.check_value_gradient_consistency(hamiltonian, field) S = ift.ScalingOperator(1., space) samps = [S.draw_sample() for i in range(3)] - kl = ift.SampledKullbachLeiblerDivergence(hamiltonian, samps) + kl = ift.AveragedEnergy(hamiltonian, samps) ift.extra.check_value_gradient_consistency(kl, field)