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
70a4c327
Commit
70a4c327
authored
1 year ago
by
Gordian Edenhofer
Browse files
Options
Downloads
Patches
Plain Diff
likelihood: Remove most refs. to Hamiltonian
parent
4a3188ee
No related branches found
No related tags found
1 merge request
!904
Re likelihood
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/re/likelihood.py
+9
-9
9 additions, 9 deletions
src/re/likelihood.py
with
9 additions
and
9 deletions
src/re/likelihood.py
+
9
−
9
View file @
70a4c327
...
...
@@ -215,7 +215,7 @@ class Likelihood(AbstractModel):
"""
# TODO: track forward model and build lsm, metric, residual only when
# called instead of always partially
self
.
_
hamiltonian
=
energy
self
.
_
energy
=
energy
self
.
_transformation
=
transformation
self
.
_normalized_residual
=
normalized_residual
self
.
_left_sqrt_metric
=
left_sqrt_metric
...
...
@@ -260,7 +260,7 @@ class Likelihood(AbstractModel):
energy : float
Energy at the position `primals`.
"""
return
self
.
_
hamiltonian
(
primals
,
**
primals_kw
)
return
self
.
_
energy
(
primals
,
**
primals_kw
)
def
normalized_residual
(
self
,
primals
,
**
primals_kw
):
"""
Applies the normalized_residual to `primals`.
...
...
@@ -490,7 +490,7 @@ class Likelihood(AbstractModel):
j_trafo
,
j_lsm
,
j_rsm
,
j_m
=
None
,
None
,
None
,
None
return
self
.
replace
(
jit
(
self
.
_
hamiltonian
,
**
kwargs
),
jit
(
self
.
_
energy
,
**
kwargs
),
normalized_residual
=
j_r
,
transformation
=
j_trafo
,
left_sqrt_metric
=
j_lsm
,
...
...
@@ -613,7 +613,7 @@ class Likelihood(AbstractModel):
Vector
)
or
isinstance
(
other
.
_lsm_tan_shp
,
Vector
):
joined_tangents_shape
=
Vector
(
joined_tangents_shape
)
def
joined_
hamiltonian
(
p
,
**
pkw
):
def
joined_
energy
(
p
,
**
pkw
):
return
self
.
energy
(
p
,
**
pkw
)
+
other
.
energy
(
p
,
**
pkw
)
def
joined_normalized_residual
(
p
,
**
pkw
):
...
...
@@ -668,7 +668,7 @@ class Likelihood(AbstractModel):
raise
ValueError
(
ve
)
return
Likelihood
(
joined_
hamiltonian
,
joined_
energy
,
normalized_residual
=
joined_normalized_residual
,
transformation
=
joined_transformation
,
left_sqrt_metric
=
joined_left_sqrt_metric
,
...
...
@@ -778,7 +778,7 @@ class StandardHamiltonian():
"""
self
.
_lh
=
likelihood
def
joined_
hamiltonian
(
primals
,
**
primals_kw
):
def
joined_
energy
(
primals
,
**
primals_kw
):
# Assume the first primals to be the parameters
return
self
.
_lh
(
primals
,
**
primals_kw
)
+
0.5
*
vdot
(
primals
,
primals
)
...
...
@@ -788,9 +788,9 @@ class StandardHamiltonian():
if
_compile_joined
:
from
jax
import
jit
joined_
hamiltonian
=
jit
(
joined_
hamiltonian
,
**
_compile_kwargs
)
joined_
energy
=
jit
(
joined_
energy
,
**
_compile_kwargs
)
joined_metric
=
jit
(
joined_metric
,
**
_compile_kwargs
)
self
.
_
hamiltonian
=
joined_hamiltonian
self
.
_
energy
=
joined_energy
self
.
_metric
=
joined_metric
@doc_from
(
Likelihood
.
__call__
)
...
...
@@ -799,7 +799,7 @@ class StandardHamiltonian():
@doc_from
(
Likelihood
.
energy
)
def
energy
(
self
,
primals
,
**
primals_kw
):
return
self
.
_
hamiltonian
(
primals
,
**
primals_kw
)
return
self
.
_
energy
(
primals
,
**
primals_kw
)
@doc_from
(
Likelihood
.
metric
)
def
metric
(
self
,
primals
,
tangents
,
**
primals_kw
):
...
...
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