Maud’s data model

The main job of Maud’s data model is to define an object called MaudInput which represents in Python all the information provided by the user, and holds the information that is passed to Stan. It extensively uses pydantic dataclasses for validation.

Code implementing Maud’s data model is in the folder src/maud/data_model.

The information provided by the users consists of:

  • Configuration represented as a MaudConfig object

  • A kinetic model represented by a KineticModel object

  • Priors represented by a UserPriorInput object

  • Measurements represented by a MeasurementSet object

  • Initial parameter values represented by an optional pandas DataFrame

On initialisation a MaudInput performs the following steps:

  • Stan variables are inferred from the kinetic model and measurements, creating a StanVariableSet.

  • User-specified priors are supplemented with defaults to create a PriorSet. The StanVariableSet is required at this stage in order to ensure correct shapes.

  • A full set of initial values is created using prior means as defaults.

  • Stan inputs for the train and test models are created as StanInputTrain and StanInputTest objects.

MaudConfig is a simple python representation for the user toml input and specifies defaults for the non-obligatory fields.

The KineticModel class validates the user toml input and supplements it with attributes drains, edges and stoichiometric_matrix.

UserPriorInput is a thin container for the user-provided prior files.

MeasurementSet contains user-provided measurement and experimental setup information.

StanVariableSet specifies which parameters appear in Maud’s statistical model, and provides structural information about each parameter, such as its shape, default location and scale and composition of its ids.

PriorSet specifies what kind of prior each parameter should have. The options are independent 1d, independent 2d or multivariate 1d.

StanInputTrain and StanInputTest specify what data can possibly go into Maud’s Stan input dictionaries, performs validation and sets out what these dictionaries should look like.