Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Merge requests
!401
Gauss sampling dtype
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Gauss sampling dtype
gauss_sampling_dtype
into
NIFTy_6
Overview
1
Commits
3
Pipelines
1
Changes
3
Merged
Philipp Arras
requested to merge
gauss_sampling_dtype
into
NIFTy_6
5 years ago
Overview
1
Commits
3
Pipelines
1
Changes
3
Expand
0
0
Merge request reports
Compare
NIFTy_6
NIFTy_6 (base)
and
latest version
latest version
bb1069ae
3 commits,
5 years ago
3 files
+
16
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
nifty6/minimization/metric_gaussian_kl.py
+
7
−
3
Options
@@ -14,6 +14,7 @@
# Copyright(C) 2013-2019 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
from
..
import
utilities
from
..linearization
import
Linearization
@@ -78,7 +79,7 @@ class MetricGaussianKL(Energy):
def
__init__
(
self
,
mean
,
hamiltonian
,
n_samples
,
constants
=
[],
point_estimates
=
[],
mirror_samples
=
False
,
napprox
=
0
,
_samples
=
None
):
napprox
=
0
,
_samples
=
None
,
lh_sampling_dtype
=
np
.
float64
):
super
(
MetricGaussianKL
,
self
).
__init__
(
mean
)
if
not
isinstance
(
hamiltonian
,
StandardHamiltonian
):
@@ -99,7 +100,8 @@ class MetricGaussianKL(Energy):
mean
,
point_estimates
,
True
)).
metric
if
napprox
>
1
:
met
.
_approximation
=
makeOp
(
approximation2endo
(
met
,
napprox
))
_samples
=
tuple
(
met
.
draw_sample
(
from_inverse
=
True
)
_samples
=
tuple
(
met
.
draw_sample
(
from_inverse
=
True
,
dtype
=
lh_sampling_dtype
)
for
_
in
range
(
n_samples
))
if
mirror_samples
:
_samples
+=
tuple
(
-
s
for
s
in
_samples
)
@@ -120,11 +122,13 @@ class MetricGaussianKL(Energy):
self
.
_grad
=
g
*
(
1.
/
len
(
self
.
_samples
))
self
.
_metric
=
None
self
.
_napprox
=
napprox
self
.
_sampdt
=
lh_sampling_dtype
def
at
(
self
,
position
):
return
MetricGaussianKL
(
position
,
self
.
_hamiltonian
,
0
,
self
.
_constants
,
self
.
_point_estimates
,
napprox
=
self
.
_napprox
,
_samples
=
self
.
_samples
)
napprox
=
self
.
_napprox
,
_samples
=
self
.
_samples
,
lh_sampling_dtype
=
self
.
_sampdt
)
@property
def
value
(
self
):
Loading