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

more convenient MCMC #33

Open
teddygroves opened this issue Dec 19, 2024 · 0 comments
Open

more convenient MCMC #33

teddygroves opened this issue Dec 19, 2024 · 0 comments

Comments

@teddygroves
Copy link
Contributor

I tried to quickly add documentation for MCMC sampling and realised it is currently pretty convoluted.

I would like to refactor so that the user can do something like this:

from functools import partial

from jax import numpy as jnp

from enzax.examples import methionine 
from enzax.mcmc import run_nuts
from enzax.statistical_modelling import (
	ObservationSet,
	prior_from_truth,
	enzax_default_log_density
)
obs = ObservationSet(
    conc={"met-L": 0.01},
    flux={"AHC1": 0.5},
    enzyme={"MS1": 1.6},
    conc_error_sd=0.1,
    flux_error_sd=0.2,
    enzyme_error_sd={"MS1": 0.15}
)
fixed_parameters = {“temperature”: jnp.array(310.0)}
prior_mean, prior_sd = prior_from_truth(methionine.parameters, sd=0.1)
posterior = partial(
	enzax_default_log_density,
	fixed_parameters=fixed_parameters,
	obs=obs,
	prior_mean=prior_mean,
	prior_sd=prior_sd,
)
samples, info = run_nuts(posterior)

I think that is basically the most minimal it could be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant