phys201 / multstars

A package for parameter estimation of stellar multiplicity properties
GNU General Public License v3.0
0 stars 0 forks source link

Consider taking more advantage of pymc3 distributions #16

Closed barkls closed 4 years ago

barkls commented 4 years ago

pymc3 has a very powerful framework to define probabilistic problems, but you aren't really taking advantage of that right now with your separate log_likelihood function. For example, right now you define likelihood of each data point as being a Gaussian given by a convolution between the width of the underlying distribution and the uncertainty on each data point. This analytical convolution through sum of variances is fine for Gaussians, but it won't extent to modelling other distributions. With pymc3 you could instead do something like :


# note: I haven't actually tested this code - it's just an example to demonstrate what I mean
underlying_distribution = pm.Normal(name, mean, sigma)
measurement_uncertaitny = pm.Normal(name, mean sigma)
observations = pm.Deterministic('measurements', underlying_distribution + measurement_uncertainty, obsverved=data)
vnmanoharan commented 4 years ago

Bumping this issue. Any progress on getting this to work? It will be important to get this model working in pymc3 before you start on the more advanced model. Should only take a few lines of code.

cmlamman commented 4 years ago

Taken care of - I've changed the existing code to a basic (non-hierarchical) pymc3 model without an outside likelihood function.