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
Commits
174f63eb
Commit
174f63eb
authored
2 years ago
by
Gordian Edenhofer
Browse files
Options
Downloads
Patches
Plain Diff
re.kl.py: Fix tables in docstrings
parent
3525c88d
No related branches found
No related tags found
1 merge request
!780
Fix docstring formatting
Pipeline
#132848
passed
2 years ago
Stage: static_checks
Stage: build_docker
Stage: test
Stage: demo_runs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/re/kl.py
+8
-12
8 additions, 12 deletions
src/re/kl.py
with
8 additions
and
12 deletions
src/re/kl.py
+
8
−
12
View file @
174f63eb
...
@@ -32,6 +32,7 @@ def cond_raise(condition, exception):
...
@@ -32,6 +32,7 @@ def cond_raise(condition, exception):
call
(
maybe_raise
,
condition
,
result_shape
=
None
)
call
(
maybe_raise
,
condition
,
result_shape
=
None
)
# TODO (?): optionally accept ham.metric and likelihood.lsm
def
_sample_standard_hamiltonian
(
def
_sample_standard_hamiltonian
(
hamiltonian
:
StandardHamiltonian
,
hamiltonian
:
StandardHamiltonian
,
primals
,
primals
,
...
@@ -144,6 +145,7 @@ def sample_standard_hamiltonian(
...
@@ -144,6 +145,7 @@ def sample_standard_hamiltonian(
return
inv_met_smpl
return
inv_met_smpl
# TODO (?): optionally accept ham.metric and likelihood.lsm and likelihood.transformation
def
geometrically_sample_standard_hamiltonian
(
def
geometrically_sample_standard_hamiltonian
(
hamiltonian
:
StandardHamiltonian
,
hamiltonian
:
StandardHamiltonian
,
primals
,
primals
,
...
@@ -400,7 +402,6 @@ def MetricKL(
...
@@ -400,7 +402,6 @@ def MetricKL(
Parameters
Parameters
----------
----------
hamiltonian : :class:`nifty8.src.re.likelihood.StandardHamiltonian`
hamiltonian : :class:`nifty8.src.re.likelihood.StandardHamiltonian`
Hamiltonian of the approximated probability distribution.
Hamiltonian of the approximated probability distribution.
primals : :class:`nifty8.re.field.Field`
primals : :class:`nifty8.re.field.Field`
...
@@ -409,7 +410,7 @@ def MetricKL(
...
@@ -409,7 +410,7 @@ def MetricKL(
Number of samples used to stochastically estimate the KL.
Number of samples used to stochastically estimate the KL.
key : DeviceArray
key : DeviceArray
A PRNG-key.
A PRNG-key.
mirror_samples : bool
ean
mirror_samples : bool
Whether the mirrored version of the drawn samples are also used.
Whether the mirrored version of the drawn samples are also used.
If true, the number of used samples doubles.
If true, the number of used samples doubles.
Mirroring samples stabilizes the KL estimate as extreme
Mirroring samples stabilizes the KL estimate as extreme
...
@@ -420,10 +421,8 @@ def MetricKL(
...
@@ -420,10 +421,8 @@ def MetricKL(
itself. The function is used to map the drawing of samples. Possible
itself. The function is used to map the drawing of samples. Possible
string-keys are:
string-keys are:
keys - functions
-
'
pmap
'
or
'
p
'
for `jax.pmap`
-------------------------------------
-
'
lax.map
'
or
'
lax
'
for `jax.lax.map`
'
pmap
'
or
'
p
'
- jax.pmap
'
lax.map
'
or
'
lax
'
- jax.lax.map
In case sample_mapping is passed as a function, it should produce a
In case sample_mapping is passed as a function, it should produce a
mapped function f_mapped of a general function f as: `f_mapped =
mapped function f_mapped of a general function f as: `f_mapped =
...
@@ -557,7 +556,6 @@ def mean_value_and_grad(ham: Callable, sample_mapping='vmap', *args, **kwargs):
...
@@ -557,7 +556,6 @@ def mean_value_and_grad(ham: Callable, sample_mapping='vmap', *args, **kwargs):
Parameters
Parameters
----------
----------
ham : :class:`nifty8.src.re.likelihood.StandardHamiltonian`
ham : :class:`nifty8.src.re.likelihood.StandardHamiltonian`
Hamiltonian of the approximated probability distribution,
Hamiltonian of the approximated probability distribution,
of which the mean value and the mean gradient are to be computed.
of which the mean value and the mean gradient are to be computed.
...
@@ -566,11 +564,9 @@ def mean_value_and_grad(ham: Callable, sample_mapping='vmap', *args, **kwargs):
...
@@ -566,11 +564,9 @@ def mean_value_and_grad(ham: Callable, sample_mapping='vmap', *args, **kwargs):
itself. The function is used to map the drawing of samples. Possible
itself. The function is used to map the drawing of samples. Possible
string-keys are:
string-keys are:
keys - functions
-
'
vmap
'
or
'
v
'
for `jax.vmap`
-------------------------------------
-
'
pmap
'
or
'
p
'
for `jax.pmap`
'
vmap
'
or
'
v
'
- jax.vmap
-
'
lax.map
'
or
'
lax
'
for `jax.lax.map`
'
pmap
'
or
'
p
'
- jax.pmap
'
lax.map
'
or
'
lax
'
- jax.lax.map
In case sample_mapping is passed as a function, it should produce a
In case sample_mapping is passed as a function, it should produce a
mapped function f_mapped of a general function f as: `f_mapped =
mapped function f_mapped of a general function f as: `f_mapped =
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment