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
a69f5a5f
Commit
a69f5a5f
authored
Jun 01, 2021
by
Philipp Arras
Browse files
fixup! Port to geoVI compatible NIFTy_7
parent
7a2af8a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/minimization/stochastic_minimizer.py
View file @
a69f5a5f
...
...
@@ -16,6 +16,7 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from
.minimizer
import
Minimizer
from
.energy
import
Energy
class
ADVIOptimizer
(
Minimizer
):
...
...
@@ -26,6 +27,9 @@ class ADVIOptimizer(Minimizer):
----------
steps: int
The number of concecutive steps during one call of the optimizer.
resample_energy : function
Function that returns an `Energy` object at a given position. It is
called after every step of the optimizer.
eta: positive float
The scale of the step-size sequence. It might have to be adapted to the
application to increase performance. Default: 1.
...
...
@@ -59,7 +63,7 @@ class ADVIOptimizer(Minimizer):
return
new_position
def
__call__
(
self
,
E
):
from
..
minimization.kl_energies
import
ParametricGaussianKL
from
..
utilities
import
myassert
if
self
.
s
is
None
:
self
.
s
=
E
.
gradient
**
2
# FIXME come up with somthing how to determine convergence
...
...
@@ -67,6 +71,8 @@ class ADVIOptimizer(Minimizer):
for
i
in
range
(
self
.
steps
):
x
=
self
.
_step
(
E
.
position
,
E
.
gradient
)
E
=
self
.
_resample
(
x
)
myassert
(
isinstance
(
E
,
Energy
))
myassert
(
x
.
domain
,
E
.
position
.
domain
)
return
E
,
convergence
def
reset
(
self
):
...
...
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