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
01575b9f
Commit
01575b9f
authored
11 months ago
by
Colm Talbot
Browse files
Options
Downloads
Patches
Plain Diff
BUG: fix Pymc sampler import
parent
2b93355c
No related branches found
No related tags found
1 merge request
!1349
BUG: fix Pymc sampler import
Pipeline
#613834
failed
11 months ago
Stage: initial
Stage: test
Stage: docs
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/core_examples/alternative_samplers/linear_regression_pymc_custom_likelihood.py
+4
-8
4 additions, 8 deletions
...tive_samplers/linear_regression_pymc_custom_likelihood.py
with
4 additions
and
8 deletions
examples/core_examples/alternative_samplers/linear_regression_pymc_custom_likelihood.py
+
4
−
8
View file @
01575b9f
...
...
@@ -12,6 +12,7 @@ import bilby
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
pymc
as
pm
from
bilby.core.sampler.pymc
import
Pymc
# A few simple setup steps
label
=
"
linear_regression_pymc_custom_likelihood
"
...
...
@@ -76,13 +77,11 @@ class GaussianLikelihoodPyMC(bilby.core.likelihood.GaussianLikelihood):
----------
sampler: :class:`bilby.core.sampler.Pymc`
A Sampler object must be passed containing the prior distributions
and PyMC
3
:class:`~pymc
3
.Model` to use as a context manager.
and PyMC :class:`~pymc.Model` to use as a context manager.
If this is not passed, the super class is called and the regular
likelihood is evaluated.
"""
from
bilby.core.sampler.pymc
import
Pymc
if
not
isinstance
(
sampler
,
Pymc
):
return
super
(
GaussianLikelihoodPyMC
,
self
).
log_likelihood
()
...
...
@@ -116,15 +115,12 @@ class PyMCUniformPrior(bilby.core.prior.Uniform):
def
ln_prob
(
self
,
sampler
=
None
):
"""
Change ln_prob method to take in a Sampler and return a PyMC
3
Change ln_prob method to take in a Sampler and return a PyMC
distribution.
If the passed argument is not a `Pymc
3
` sampler, assume that it is a
If the passed argument is not a `Pymc` sampler, assume that it is a
float or array to be passed to the superclass.
"""
from
bilby.core.sampler
import
Pymc
if
not
isinstance
(
sampler
,
Pymc
):
return
super
(
PyMCUniformPrior
,
self
).
ln_prob
(
sampler
)
...
...
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