ScottishCovidResponse / SCRCIssueTracking

Central issue tracking repository for all repos in the consortium
6 stars 0 forks source link

Expose the high level representation of a Distribution via the Python API #635

Open ianhinder opened 4 years ago

ianhinder commented 4 years ago

The Python implementation of the standard API works in terms of scipy distribution objects. For the C++ wrapper, we need to get the high level features stored in the TOML file; i.e. a name and a set of named parameters (I think!). Ideally, we would like a function which converted a Distribution into something like {'name' : 'gamma', 'params' : {'shape' : 1.0, 'scale' : 2.0}}, i.e using the logic in parameter_file.py.

In the short term, I can just replicate that code in pybind, but since the python code will presumably be updated to support more distributions with different sets of parameters, it would be good to avoid duplication of logic.

Note: one way to make this clean would be to have a keyword argument on read_distribution to say whether you wanted to return a scipy distribution object, or the high level representation (name, params, etc). The latter doesn't even need to go via the scipy distribution, as it's directly available in the TOML file.

github-actions[bot] commented 4 years ago

Heads up @mrow84 @bobturneruk - the "data pipeline api" label was applied to this issue.