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
05784024
Commit
05784024
authored
Feb 22, 2019
by
Martin Reinecke
Browse files
revert demo changes
parent
5c593a5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
demos/getting_started_3.py
View file @
05784024
...
@@ -122,12 +122,12 @@ if __name__ == '__main__':
...
@@ -122,12 +122,12 @@ if __name__ == '__main__':
plot
.
output
(
ny
=
1
,
nx
=
3
,
xsize
=
24
,
ysize
=
6
,
name
=
filename
.
format
(
"setup"
))
plot
.
output
(
ny
=
1
,
nx
=
3
,
xsize
=
24
,
ysize
=
6
,
name
=
filename
.
format
(
"setup"
))
# number of samples used to estimate the KL
# number of samples used to estimate the KL
N_samples
=
2
N_samples
=
2
0
# Draw new samples to approximate the KL five times
# Draw new samples to approximate the KL five times
for
i
in
range
(
5
):
for
i
in
range
(
5
):
# Draw new samples and minimize KL
# Draw new samples and minimize KL
KL
=
ift
.
MetricGaussianKL
_MPI
(
mean
,
H
,
N_samples
)
KL
=
ift
.
MetricGaussianKL
(
mean
,
H
,
N_samples
)
KL
,
convergence
=
minimizer
(
KL
)
KL
,
convergence
=
minimizer
(
KL
)
mean
=
KL
.
position
mean
=
KL
.
position
...
@@ -139,7 +139,7 @@ if __name__ == '__main__':
...
@@ -139,7 +139,7 @@ if __name__ == '__main__':
name
=
filename
.
format
(
"loop_{:02d}"
.
format
(
i
)))
name
=
filename
.
format
(
"loop_{:02d}"
.
format
(
i
)))
# Draw posterior samples
# Draw posterior samples
KL
=
ift
.
MetricGaussianKL
_MPI
(
mean
,
H
,
N_samples
)
KL
=
ift
.
MetricGaussianKL
(
mean
,
H
,
N_samples
)
sc
=
ift
.
StatCalculator
()
sc
=
ift
.
StatCalculator
()
for
sample
in
KL
.
samples
:
for
sample
in
KL
.
samples
:
sc
.
add
(
signal
(
sample
+
KL
.
position
))
sc
.
add
(
signal
(
sample
+
KL
.
position
))
...
...
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