Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neel Shah
NIFTy
Commits
8d1fb1ae
Commit
8d1fb1ae
authored
Jun 09, 2021
by
Philipp Arras
Browse files
Cosmetics
parent
d6b86d97
Changes
4
Hide whitespace changes
Inline
Side-by-side
demos/meanfield_inference.py
View file @
8d1fb1ae
...
...
@@ -56,7 +56,8 @@ if __name__ == "__main__":
fc
=
ift
.
FullCovarianceVI
(
position_fc
,
H
,
3
,
True
,
initial_sig
=
0.01
)
mf
=
ift
.
MeanFieldVI
(
position_mf
,
H
,
3
,
True
,
initial_sig
=
0.01
)
IC
=
ift
.
StochasticAbsDeltaEnergyController
(
10
,
iteration_limit
=
1000
,
name
=
'optimizer'
)
IC
=
ift
.
StochasticAbsDeltaEnergyController
(
10
,
iteration_limit
=
1000
,
name
=
'advi'
)
minimizer_fc
=
ift
.
ADVIOptimizer
(
IC
,
eta
=
0.1
)
minimizer_mf
=
ift
.
ADVIOptimizer
(
IC
)
...
...
src/library/variational_models.py
View file @
8d1fb1ae
...
...
@@ -139,8 +139,8 @@ class FullCovarianceVI:
pos
=
MultiField
.
from_dict
(
{
'mean'
:
Flat
(
position
),
'cov'
:
LT
.
adjoint
(
makeField
(
mat_space
,
diag_tri
))})
self
.
_
op
=
hamiltonian
(
self
.
_generator
)
+
self
.
_entropy
self
.
_KL
=
StochasticEnergyAdapter
.
make
(
pos
,
self
.
_
op
,
[
'latent'
,],
n_samples
,
op
=
hamiltonian
(
self
.
_generator
)
+
self
.
_entropy
self
.
_KL
=
StochasticEnergyAdapter
.
make
(
pos
,
op
,
[
'latent'
,],
n_samples
,
mirror_samples
,
nanisinf
=
nanisinf
,
comm
=
comm
)
self
.
_mean
=
Flat
.
adjoint
@
mean
self
.
_samdom
=
lat
.
domain
...
...
src/minimization/iteration_controllers.py
View file @
8d1fb1ae
...
...
@@ -422,8 +422,9 @@ class AbsDeltaEnergyController(IterationController):
return
self
.
CONTINUE
class
StochasticAbsDeltaEnergyController
(
IterationController
):
"""An iteration controller checking the standard deviation over a
"""An iteration controller checking the standard deviation over a
period of iterations. Convergence is reported once this quantity
falls below the given threshold
...
...
src/minimization/stochastic_minimizer.py
View file @
8d1fb1ae
...
...
@@ -48,7 +48,6 @@ class ADVIOptimizer(Minimizer):
self
.
epsilon
=
epsilon
self
.
counter
=
1
self
.
_controller
=
controller
# self.steps = steps
self
.
s
=
None
self
.
resample
=
resample
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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