Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bilby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
lscsoft
bilby
Commits
5de653b8
Commit
5de653b8
authored
6 years ago
by
Matthew David Pitkin
Browse files
Options
Downloads
Patches
Plain Diff
prior.py: add pymc3_prior method to Gaussian prior
parent
1abfa584
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!139
Add PyMC3 sampler
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tupak/core/prior.py
+10
-2
10 additions, 2 deletions
tupak/core/prior.py
with
10 additions
and
2 deletions
tupak/core/prior.py
+
10
−
2
View file @
5de653b8
...
...
@@ -802,7 +802,7 @@ class Sine(Prior):
class
Gaussian
(
Prior
):
def
__init__
(
self
,
mu
,
sigma
,
name
=
None
,
latex_label
=
None
):
def
__init__
(
self
,
mu
,
sigma
,
name
=
None
,
latex_label
=
None
,
use_pymc3
=
False
):
"""
Gaussian prior with mean mu and width sigma
Parameters
...
...
@@ -820,7 +820,7 @@ class Gaussian(Prior):
latex_label: str
See superclass
"""
Prior
.
__init__
(
self
,
name
,
latex_label
)
Prior
.
__init__
(
self
,
name
,
latex_label
,
use_pymc3
=
use_pymc3
)
self
.
mu
=
mu
self
.
sigma
=
sigma
...
...
@@ -849,6 +849,14 @@ class Gaussian(Prior):
def
lnprob
(
self
,
val
):
return
-
0.5
*
((
self
.
mu
-
val
)
**
2
/
self
.
sigma
**
2
+
np
.
log
(
2
*
np
.
pi
*
self
.
sigma
**
2
))
def
pymc3_prior
(
self
,
sampler
):
priortype
=
'
Normal
'
priorargs
=
{}
priorargs
[
'
mu
'
]
=
self
.
mu
priorargs
[
'
sd
'
]
=
self
.
sigma
return
self
.
set_pymc3_prior
(
sampler
,
priortype
,
**
priorargs
)
def
__repr__
(
self
):
"""
Call to helper method in the super class.
"""
return
Prior
.
_subclass_repr_helper
(
self
,
subclass_args
=
[
'
mu
'
,
'
sigma
'
])
...
...
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