Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include pymc in the documentation. #1305

Merged
merged 7 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ API reference
pypesto.profile.profile_next_guess
pypesto.result
pypesto.sample
pypesto.sample.pymc
pypesto.select
pypesto.select.postprocessors
pypesto.startpoint
Expand Down
58 changes: 29 additions & 29 deletions pypesto/result/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,7 @@


class McmcPtResult(dict):
"""
The result of a sampler run using Markov-chain Monte Carlo.

Currently result object of all supported samplers. Can be used like a dict.

Parameters
----------
trace_x: [n_chain, n_iter, n_par]
Parameters.
trace_neglogpost: [n_chain, n_iter]
Negative log posterior values.
trace_neglogprior: [n_chain, n_iter]
Negative log prior values.
betas: [n_chain]
The associated inverse temperatures.
burn_in: [n_chain]
The burn in index.
time: [n_chain]
The computation time.
auto_correlation: [n_chain]
The estimated chain autcorrelation.
effective_sample_size: [n_chain]
The estimated effective sample size.
message: str
Textual comment on the profile result.

Here, `n_chain` denotes the number of chains, `n_iter` the number of
iterations (i.e., the chain length), and `n_par` the number of parameters.
"""
"""The result of a sampler run using Markov-chain Monte Carlo."""

def __init__(
self,
Expand All @@ -48,6 +20,34 @@ def __init__(
effective_sample_size: float = None,
message: str = None,
):
"""
Initialize the McmcPtResult.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these now documented as constructor parameters? Attributes seems more appropriate


Here, `n_chain` denotes the number of chains, `n_iter` the number of
iterations (i.e., the chain length), and `n_par` the number of
parameters.

Parameters
----------
trace_x: [n_chain, n_iter, n_par]
Parameters.
trace_neglogpost: [n_chain, n_iter]
Negative log posterior values.
trace_neglogprior: [n_chain, n_iter]
Negative log prior values.
betas: [n_chain]
The associated inverse temperatures.
burn_in: [n_chain]
The burn in index.
time: [n_chain]
The computation time.
auto_correlation: [n_chain]
The estimated chain autcorrelation.
effective_sample_size: [n_chain]
The estimated effective sample size.
message: str
Textual comment on the profile result.
"""
super().__init__()

self.trace_x = trace_x
Expand Down
8 changes: 8 additions & 0 deletions pypesto/sample/pymc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@

logger = logging.getLogger(__name__)

# __all__ definition for Sphinx
PaulJonasJost marked this conversation as resolved.
Show resolved Hide resolved
__all__ = [
'PymcSampler',
'PymcObjectiveWithGradientOp',
'PymcObjectiveOp',
'PymcGradientOp',
]

# implementation based on:
# https://www.pymc.io/projects/examples/en/latest/case_studies/blackbox_external_likelihood_numpy.html

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ doc =
%(petab)s
%(aesara)s
%(jax)s
%(pymc)s
example =
%(julia)s
%(pymc)s
Expand Down
Loading