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
ift
NIFTy
Commits
d7c1bfd2
Commit
d7c1bfd2
authored
Mar 01, 2021
by
Jakob Knollmüller
Browse files
fix
parent
b8759ef9
Pipeline
#94632
failed with stages
in 5 minutes and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
demos/meanfield_demo.py
View file @
d7c1bfd2
...
...
@@ -95,8 +95,8 @@ if __name__ == '__main__':
fullcov_model
=
ift
.
FullCovarianceModel
(
H
.
domain
)
meanfield_model
=
ift
.
MeanfieldModel
(
H
.
domain
)
position_fc
=
fullcov_model
.
get_initial_pos
()
position_mf
=
meanfield_model
.
get_initial_pos
()
position_fc
=
fullcov_model
.
get_initial_pos
(
initial_sig
=
0.1
)
position_mf
=
meanfield_model
.
get_initial_pos
(
initial_sig
=
0.1
)
KL_fc
=
ift
.
ParametricGaussianKL
.
make
(
position_fc
,
H
,
fullcov_model
,
3
,
True
)
KL_mf
=
ift
.
ParametricGaussianKL
.
make
(
position_mf
,
H
,
meanfield_model
,
3
,
True
)
...
...
src/library/variational_models.py
View file @
d7c1bfd2
...
...
@@ -67,7 +67,7 @@ class FullCovarianceModel():
def
get_initial_pos
(
self
,
initial_mean
=
None
,
initial_sig
=
1
):
initial_pos
=
from_random
(
self
.
generator
.
domain
).
to_dict
()
initial_pos
[
'latent'
]
=
full
(
self
.
generator
.
domain
[
'latent'
],
0.
)
diag_tri
=
np
.
diag
(
np
.
full
(
self
.
flat_domain
.
shape
[
0
]
),
initial_sig
)[
np
.
tril_indices
(
self
.
flat_domain
.
shape
[
0
])]
diag_tri
=
np
.
diag
(
np
.
full
(
self
.
flat_domain
.
shape
[
0
]
,
initial_sig
)
)
[
np
.
tril_indices
(
self
.
flat_domain
.
shape
[
0
])]
initial_pos
[
'cov'
]
=
makeField
(
self
.
generator
.
domain
[
'cov'
],
diag_tri
)
if
initial_mean
is
None
:
initial_mean
=
0.1
*
from_random
(
self
.
generator
.
target
)
...
...
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