Skip to content

Distributions - design points for discussion #16

@TomMonks

Description

@TomMonks

A few points all related to the use of the distributions that we should discuss:

Distributions are also parameters

The design you have used (where distributions are part of the model class) is definitely valid (especially to get reproducible results), but in general the type of distribution used is a parameter that can be varied in a simulation model run. For example, we might switch from a Lognormal to a Exponential or Fixed distribution as part of model validation. Or we might switch from Lognormal to an Empirical distribution if lognormals are not suitable for different stroke pathway at a different trust (e.g when lognormal is a poor fit to the data).

At the moment it is possible to vary the parameters by monkey patching, but its not ideal to have to modify the model class.

I personally think the distributions should be decoupled from the model class itself. That way you can can modify the parameters however you need (one example is a subclassed Param class, but see below) and pass to the model which remains as intended with no dependencies on the type of distribution used (although potentially with routing, but maybe a half way how is to keep that type fixed as its model logic).

sim-tools distribution registry might help

I created the distribution registry for this very purpose. Although I've not yet had time to implement it in a model in anger. Take a look here https://tommonks.github.io/sim-tools/01_sampling/03_distributions_registry.html

That would allow us to have a more flexible model with less dependencies within the model logic.

@amyheather What do you think? I could if you wanted provide a simple example before we go any further?

Metadata

Metadata

Assignees

Labels

refactorRestructuring code, files, etc.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions