Skip to content
GitLab
Menu
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
561a434c
Commit
561a434c
authored
Aug 06, 2018
by
Martin Reinecke
Browse files
reintroduce static methods
parent
0417187d
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/library/inverse_gamma_model.py
View file @
561a434c
...
...
@@ -47,7 +47,7 @@ class InverseGammaModel(Operator):
val
=
x
.
val
.
local_data
if
lin
else
x
.
local_data
# MR FIXME?!
points
=
np
.
clip
(
val
,
None
,
8.2
)
points
=
self
.
IG
(
points
)
points
=
invgamma
.
ppf
(
norm
.
cdf
(
points
),
self
.
_alpha
,
scale
=
self
.
_q
)
points
=
Field
.
from_local_data
(
self
.
_domain
,
points
)
if
not
lin
:
return
points
...
...
@@ -63,11 +63,12 @@ class InverseGammaModel(Operator):
jac
=
jac
(
x
.
jac
)
return
Linearization
(
points
,
jac
)
def
IG
(
self
,
field
):
return
invgamma
.
ppf
(
norm
.
cdf
(
field
),
self
.
_alpha
,
scale
=
self
.
_q
)
@
staticmethod
def
IG
(
self
,
field
,
alpha
,
q
):
foo
=
invgamma
.
ppf
(
norm
.
cdf
(
field
.
local_data
),
alpha
,
scale
=
q
)
return
Field
.
from_local_data
(
field
.
domain
,
foo
)
# MR FIXME: Do we need this?
# def inverseIG(self, u):
# return Field.from_local_data(
# u.domain, norm.ppf(invgamma.cdf(u.local_data, self._alpha,
# scale=self._q)))
@
staticmethod
def
inverseIG
(
self
,
u
,
alpha
,
q
):
res
=
norm
.
ppf
(
invgamma
.
cdf
(
u
.
local_data
,
alpha
,
scale
=
q
))
return
Field
.
from_local_data
(
u
.
domain
,
res
)
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