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

cleanup, renaming

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