rmnldwg / lymph

Python package for statistical modelling of lymphatic metastatic spread in head & neck cancer.

Home Page:https://lymph-model.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

semantic likelihood

rmnldwg opened this issue · comments

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.

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.

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