rmnldwg / lymph

Python package for statistical modelling of lymphatic metastatic spread in head & neck cancer.
https://lymph-model.readthedocs.io
MIT License
5 stars 4 forks source link

semantic likelihood #24

Closed rmnldwg closed 1 year ago

rmnldwg commented 2 years ago

I found out that emcee's EnsembleSampler has a parameter_names argument. Providing it, the sampler will then pass a dictionary of values to the likelihood function. With this I could make the likelihood function semantic, instead of describing in a lot of detail where to put which sets of parameters.

rmnldwg commented 1 year ago

In a similar fashion: I don't like having numerous different likelihood functions all with long, convoluted names that call each other. Ideally, I would like to have a likelihood that reads like a sentence:

model.likelihood(of=data, given=params, log=True)

However, this would lead to unreadable method code. Maybe a compromise would be something like

model.likelihood(data=data, given_params=theta, log=True)

which looses little in terms of API readability but is actually quite nice in the source code as well.

rmnldwg commented 1 year ago

the new likelihood method implemented in the commits up to 1cde3e720dba895f6e3d51fd839b9fb791917fd9 is much more semantic and readable