Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
09d93746
Commit
09d93746
authored
Jan 16, 2019
by
Martin Reinecke
Browse files
cleanup, renaming
parent
41aa60bf
Changes
4
Hide whitespace changes
Inline
Side-by-side
nifty5/__init__.py
View file @
09d93746
...
...
@@ -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
,
SampledKullbachLeiblerDi
verge
nce
)
BernoulliEnergy
,
Hamiltonian
,
A
ver
a
ge
dEnergy
)
from
.probing
import
probe_with_posterior_samples
,
probe_diagonal
,
\
StatCalculator
...
...
nifty5/operators/energy_operators.py
View file @
09d93746
...
...
@@ -300,8 +300,8 @@ class Hamiltonian(EnergyOperator):
return
'Hamiltonian:
\n
'
+
utilities
.
indent
(
subs
)
class
SampledKullbachLeiblerDi
verge
nce
(
EnergyOperator
):
"""Class for Kullbach
Leibler (KL) Divergence or Gibbs free energies
class
A
ver
a
ge
dEnergy
(
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.
SampledKullbachLeiblerDi
verge
nce
(H) approximates
``A
ver
a
ge
dEnergy
(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 =
SampledKullbachLeiblerDi
verge
nce
(H, samples)`` represents
``KL =
A
ver
a
ge
dEnergy
(H, samples)`` represents
:math:`
\\
text{KL}(m) =
\\
sum_i H(m+v_i) / N`,
...
...
nifty5/operators/operator.py
View file @
09d93746
...
...
@@ -107,7 +107,7 @@ class Operator(NiftyMetaBase()):
Parameters
----------
x : Field
/
Multi
f
ield
x : Field
or
Multi
F
ield
the operator's input
"""
raise
NotImplementedError
...
...
test/test_energy_gradients.py
View file @
09d93746
...
...
@@ -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
.
SampledKullbachLeiblerDi
verge
nce
(
hamiltonian
,
samps
)
kl
=
ift
.
A
ver
a
ge
dEnergy
(
hamiltonian
,
samps
)
ift
.
extra
.
check_value_gradient_consistency
(
kl
,
field
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment