Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
bb413b40
Commit
bb413b40
authored
Jan 15, 2019
by
Martin Reinecke
Browse files
second round of fixes
parent
86891afb
Changes
1
Show whitespace changes
Inline
Side-by-side
nifty5/operators/energy_operators.py
View file @
bb413b40
...
...
@@ -27,7 +27,7 @@ from .simple_linear_operators import VdotOperator
class
EnergyOperator
(
Operator
):
"""
An a
bstract class from which
"""
A
bstract class from which
other specific EnergyOperator subclasses are derived.
An EnergyOperator has a scalar domain as target domain.
...
...
@@ -50,7 +50,7 @@ class SquaredNormOperator(EnergyOperator):
E = SquaredNormOperator() represents a field energy E that is the L2 norm
of a field f:
E(f) = f^dagger f
:math:`
E(f) = f^
\
dagger f
`
"""
def
__init__
(
self
,
domain
):
self
.
_domain
=
domain
...
...
@@ -65,7 +65,7 @@ class SquaredNormOperator(EnergyOperator):
class
QuadraticFormOperator
(
EnergyOperator
):
"""
Class for quadratic field energies.
"""Class for quadratic field energies.
Parameters
----------
...
...
@@ -97,7 +97,7 @@ class QuadraticFormOperator(EnergyOperator):
class
GaussianEnergy
(
EnergyOperator
):
"""
Class for energies of fields with Gaussian probability distribution.
"""Class for energies of fields with Gaussian probability distribution.
Attributes
----------
...
...
@@ -116,6 +116,7 @@ class GaussianEnergy(EnergyOperator):
an information energy for a Gaussian distribution with mean m and covariance D.
"""
def
__init__
(
self
,
mean
=
None
,
covariance
=
None
,
domain
=
None
):
self
.
_domain
=
None
if
mean
is
not
None
:
...
...
@@ -164,7 +165,7 @@ class PoissonianEnergy(EnergyOperator):
-----
E = GaussianEnergy(d) represents (up to an f-independent term log(d!))
E(f) = -\log Poisson(d|f) = sum
(f)
- d^\dagger \log(f),
:math:`
E(f) = -\log Poisson(d|f) =
\
sum
f
- d^\dagger \log(f)
`
,
where f is a Field in data space with the expectation values for
the counts.
...
...
@@ -249,7 +250,6 @@ class Hamiltonian(EnergyOperator):
is passed to SamplingEnabler to draw Gaussian distributed samples
with covariance = metric of Hamiltonian
(= Hessian without terms that generate negative eigenvalues)
default = None
Notes
-----
...
...
@@ -308,9 +308,8 @@ class SampledKullbachLeiblerDivergence(EnergyOperator):
The KL divergence between those should then be optimized for m. It is
KL(Q,P) = int Df Q(f) log Q(f)/P(f)
= < log Q(f) >_Q(f) - < log P(f) >_Q(f)
= const + < H(f) >_G(f-m,D)
:math:`KL(Q,P) = \int Df Q(f) \log Q(f)/P(f)
\\
= \left< \log Q(f)
\\
right>_Q(f) - < \log P(f) >_Q(f) = const + < H(f) >_G(f-m,D)`
in essence the information Hamiltonian averaged over a Gaussian distribution
centered on the mean m.
...
...
@@ -322,7 +321,7 @@ class SampledKullbachLeiblerDivergence(EnergyOperator):
----------
h: Hamiltonian
the Hamiltonian/energy to be averaged
res_samples : iterable Field
res_samples : iterable
of
Field
s
set of residual sample points to be added to mean field
for approximate estimation of the KL
...
...
@@ -330,7 +329,7 @@ class SampledKullbachLeiblerDivergence(EnergyOperator):
-----
KL = SampledKullbachLeiblerDivergence(H, samples) represents
KL(m) = sum_i H(m+v_i) / N,
:math:`
KL(m) =
\
sum_i H(m+v_i) / N
`
,
where v_i are the residual samples, N is their number, and m is the mean field
around which the samples are drawn.
...
...
Write
Preview
Markdown
is supported
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