module documentation

Models for the riskpredictor Django app.

The model CheckpointModel holds an upload of parameter samples that were produced during an inference run of the lymph-model. The samples should be fetched from the DVC remote storage and used to compute the prior risk matrices.

Given a specific diagnosis, as entered via the forms.RiskpredictorForm, the lymph-model package and the precomputed risk matrices in the CheckpointModel instances, the personalized risk estimates can be computed.

Class CheckpointModel Results of a round of parameter sampling for one of the lymph.models.
Function cached_compute_priors Compute the prior state dists for the given model, samples, and t_stage.
Function cached_construct_model_and_add_dists Construct the lymph model and add the distributions to it.
Function cached_fetch_and_merge_yaml Fetch and merge the YAML configuration files from the repo.
Function cached_fetch_model_samples Fetch the model samples from the HDF5 file in the DVC repo.
Function validate_configs Validate the pydantic configs necessary for constructing the model.
Type Alias ConfigAndVersionTupleType Undocumented
Variable logger Undocumented
Variable memory Undocumented
@memory.cache
def cached_compute_priors(model: Model, samples: np.ndarray, t_stage: str | int) -> np.ndarray:

Compute the prior state dists for the given model, samples, and t_stage.

@memory.cache
def cached_construct_model_and_add_dists(graph_config: GraphConfig, model_config: ModelConfig, dist_configs: dict[str | int, DistributionConfig], version: int) -> Model:

Construct the lymph model and add the distributions to it.

@memory.cache
def cached_fetch_and_merge_yaml(repo_name: str, ref: str, graph_config_path: str, model_config_path: str, dist_configs_path: str) -> dict[str, Any]:

Fetch and merge the YAML configuration files from the repo.

@memory.cache
def cached_fetch_model_samples(repo_name: str, ref: str, samples_path: str, num_samples: int, seed: int = 42) -> np.ndarray:

Fetch the model samples from the HDF5 file in the DVC repo.

def validate_configs(merged_yaml: dict[str, Any]) -> ConfigAndVersionTupleType:

Validate the pydantic configs necessary for constructing the model.

ConfigAndVersionTupleType =

Undocumented

Value
tuple[GraphConfig, ModelConfig, dict[str | int, DistributionConfig], int]
logger =

Undocumented

memory =

Undocumented