Commit 09d93746 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

cleanup, renaming

parent 41aa60bf
......@@ -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, \
......@@ -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):
``KL = SampledKullbachLeiblerDivergence(H, samples)`` represents
``KL = AveragedEnergy(H, samples)`` represents
:math:`\\text{KL}(m) = \\sum_i H(m+v_i) / N`,
......@@ -107,7 +107,7 @@ class Operator(NiftyMetaBase()):
x : Field/Multifield
x : Field or MultiField
the operator's input
raise NotImplementedError
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment