From 09d93746fc9d08d433bbc0bb14a6655a01e6e686 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Wed, 16 Jan 2019 11:09:32 +0100 Subject: [PATCH] cleanup, renaming --- nifty5/__init__.py | 2 +- nifty5/operators/energy_operators.py | 8 ++++---- nifty5/operators/operator.py | 2 +- test/test_energy_gradients.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nifty5/__init__.py b/nifty5/__init__.py index 30f7d5b4..b27fc9a0 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 41e7d696..4bbf4828 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 612b978e..780d37f0 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 9cbe7105..6541f0aa 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) -- GitLab