Example #1
0
from apps.covid_19 import calibration as base
from apps.covid_19.calibration import (
    add_standard_dispersion_parameter,
    add_standard_philippines_params,
    add_standard_philippines_targets,
    provide_default_calibration_params,
)
from autumn.region import Region
from autumn.utils.params import load_targets

targets = load_targets("covid_19", Region.PHILIPPINES)
TARGET_OUTPUTS = add_standard_philippines_targets(targets)
PAR_PRIORS = provide_default_calibration_params()
PAR_PRIORS = add_standard_philippines_params(PAR_PRIORS, Region.PHILIPPINES)
PAR_PRIORS = add_standard_dispersion_parameter(PAR_PRIORS, TARGET_OUTPUTS,
                                               "icu_occupancy")
PAR_PRIORS = add_standard_dispersion_parameter(PAR_PRIORS, TARGET_OUTPUTS,
                                               "accum_deaths")
PAR_PRIORS = add_standard_dispersion_parameter(PAR_PRIORS, TARGET_OUTPUTS,
                                               "notifications")


def run_calibration_chain(max_seconds: int, run_id: int, num_chains: int):
    base.run_calibration_chain(
        max_seconds,
        run_id,
        num_chains,
        Region.PHILIPPINES,
        PAR_PRIORS,
        TARGET_OUTPUTS,
        mode="autumn_mcmc",
Example #2
0
def get_priors(target_outputs: list):

    # Get common parameters for all Covid applications
    priors = provide_default_calibration_params()

    # Add multiplier for each Victorian cluster
    for region in Region.VICTORIA_METRO:
        region_name = region.replace("-", "_")
        priors += [
            {
                "param_name":
                f"victorian_clusters.contact_rate_multiplier_{region_name}",
                "distribution": "trunc_normal",
                "distri_params":
                [1.0, 0.5],  # Shouldn't be too peaked with these values
                "trunc_range": [0.5, np.inf],
            },
        ]

    priors += [
        {
            "param_name":
            f"victorian_clusters.contact_rate_multiplier_barwon_south_west",
            "distribution": "trunc_normal",
            "distri_params":
            [1.0, 0.5],  # Shouldn't be too peaked with these values
            "trunc_range": [0.5, np.inf],
            "jumping_sd": 0.05,
        },
        {
            "param_name":
            f"victorian_clusters.contact_rate_multiplier_regional",
            "distribution": "trunc_normal",
            "distri_params":
            [1.0, 0.5],  # Shouldn't be too peaked with these values
            "trunc_range": [0.5, np.inf],
            "jumping_sd": 0.05,
        },
        {
            "param_name": "contact_rate",
            "distribution": "uniform",
            "distri_params": [0.015, 0.06],
            "jumping_sd": 0.002,
        },
        {
            "param_name": "victorian_clusters.intercluster_mixing",
            "distribution": "uniform",
            "distri_params": [0.005, 0.05],
            "jumping_sd": 0.001,
        },
        {
            "param_name": "infectious_seed",
            "distribution": "uniform",
            "distri_params": [
                22.5,
                67.5,
            ],  # Should be multiplied by 4/9 because seed is removed from regional clusters
            "jumping_sd": 2.0,
        },
        {
            "param_name": "seasonal_force",
            "distribution": "uniform",
            "distri_params": [0.0, 0.5],
            "jumping_sd": 0.015,
        },
        {
            "param_name":
            "clinical_stratification.props.symptomatic.multiplier",
            "distribution": "trunc_normal",
            "distri_params": [1.0, 0.2],
            "trunc_range": [0.5, np.inf],
        },
        {
            "param_name":
            "clinical_stratification.non_sympt_infect_multiplier",
            "distribution": "uniform",
            "distri_params": [0.15, 0.7],
            "jumping_sd": 0.01,
        },
        {
            "param_name": "clinical_stratification.props.hospital.multiplier",
            "distribution": "uniform",
            "distri_params": [0.5, 3.0],
            "jumping_sd": 0.1,
        },
        {
            "param_name": "infection_fatality.multiplier",
            "distribution": "uniform",
            "distri_params": [0.5, 4.0],
            "jumping_sd": 0.05,
        },
        {
            "param_name": "testing_to_detection.assumed_cdr_parameter",
            "distribution": "uniform",
            "distri_params": [0.2, 0.5],
            "jumping_sd": 0.01,
        },
        {
            "param_name": "sojourn.compartment_periods.icu_early",
            "distribution": "trunc_normal",
            "distri_params": [12.7, 4.0],
            "trunc_range": [3.0, np.inf],
            "jumping_sd": 2.0,
        },
        {
            "param_name":
            "victorian_clusters.metro.mobility.microdistancing.behaviour_adjuster.parameters.effect",
            "distribution": "uniform",
            "distri_params": [0.0, 0.5],
            "jumping_sd": 0.005,
        },
        {
            "param_name":
            "victorian_clusters.metro.mobility.microdistancing.face_coverings_adjuster.parameters.effect",
            "distribution": "uniform",
            "distri_params": [0.0, 0.5],
            "jumping_sd": 0.005,
        },
        {
            "param_name": "target_output_ratio",
            "distribution": "uniform",
            "distri_params": [0.1, 0.4],
            "jumping_sd": 0.005,
        },
    ]
    return priors