Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ift
NIFTy
Commits
ab3a60c5
Commit
ab3a60c5
authored
Jan 15, 2019
by
Philipp Arras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move docstring out of init
parent
ec3bcd40
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
26 additions
and
26 deletions
+26
26
nifty5/library/inverse_gamma_operator.py
nifty5/library/inverse_gamma_operator.py
+26
26
No files found.
nifty5/library/inverse_gamma_operator.py
View file @
ab3a60c5
...
...
@@ 26,33 +26,33 @@ from ..sugar import makeOp
class
InverseGammaOperator
(
Operator
):
"""Operator which transforms a Gaussian into an inverse gamma distribution.
The pdf of the inverse gamma distribution is defined as follows:
.. math::
\f
rac {
\b
eta ^{
\a
lpha }}{\Gamma (
\a
lpha )}}x^{
\a
lpha 1}\exp \left({
\f
rac {
\b
eta }{x}}
\r
ight)
That means that for large x the pdf falls off like x^(alpha 1).
The mean of the pdf is at q / (alpha  1) if alpha > 1.
The mode is q / (alpha + 1).
This transformation is implemented as a linear interpolation which maps a
Gaussian onto a inverse gamma distribution.
Parameters

domain : Domain, tuple of Domain or DomainTuple
The domain on which the field shall be defined. This is at the same
time the domain and the target of the operator.
alpha : float
The alphaparameter of the inversegamma distribution.
q : float
The qparameter of the inversegamma distribution.
delta : float
distance between sampling points for linear interpolation.
"""
def
__init__
(
self
,
domain
,
alpha
,
q
,
delta
=
0.001
):
"""Operator which transforms a Gaussian into an inverse gamma distribution.
The pdf of the inverse gamma distribution is defined as follows:
.. math::
\f
rac {
\b
eta ^{
\a
lpha }}{\Gamma (
\a
lpha )}}x^{
\a
lpha 1}\exp \left({
\f
rac {
\b
eta }{x}}
\r
ight)
That means that for large x the pdf falls off like x^(alpha 1).
The mean of the pdf is at q / (alpha  1) if alpha > 1.
The mode is q / (alpha + 1).
This transformation is implemented as a linear interpolation which
maps a Gaussian onto a inverse gamma distribution.
Parameters

domain : Domain, tuple of Domain or DomainTuple
The domain on which the field shall be defined. This is at the same
time the domain and the target of the operator.
alpha : float
The alphaparameter of the inversegamma distribution.
q : float
The qparameter of the inversegamma distribution.
delta : float
distance between sampling points for linear interpolation.
"""
self
.
_domain
=
self
.
_target
=
DomainTuple
.
make
(
domain
)
self
.
_alpha
,
self
.
_q
,
self
.
_delta
=
float
(
alpha
),
float
(
q
),
float
(
delta
)
self
.
_xmin
,
self
.
_xmax
=

8.2
,
8.2
...
...
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