def __init__(self, region: str): self.region = region self._run_model = build_model_runner( model_name="dr_tb_malancha", param_set_name=self.region, build_model=self.build_model, params=self.params, )
def __init__(self, region: str): self.region = region self._run_model = build_model_runner( model_name="sir_example", param_set_name=self.region, build_model=self.build_model, params=self.params, )
def __init__(self, country: str): self.country = country self._run_model = build_model_runner( model_name=f"sir_drug_resistance_{country}", build_model=self.build_model, params=self.params, post_processing_config=pp_config, plots_config=plots_config, )
def run_all_phases(decision_variables, country=Region.UNITED_KINGDOM, config=0, calibrated_params={}, mode="by_age"): running_model = RegionApp(country) build_model = running_model.build_model if mode == "by_location": new_decision_variables = { "other_locations": decision_variables[0], "school": decision_variables[1], "work": decision_variables[2] } decision_variables = new_decision_variables params = copy.deepcopy(running_model.params) # update params with optimisation default config params["default"].update(opti_params["default"]) # update params with calibrated parameters params["default"] = update_params(params['default'], calibrated_params) # prepare importation rates for herd immunity testing params["default"]["data"] = { 'times_imported_cases': [0], 'n_imported_cases': [0] } params["scenarios"][1] = build_params_for_phases_2_and_3( decision_variables, config, mode) run_models = build_model_runner(model_name="covid_19", param_set_name=country, build_model=build_model, params=params) run_models()
Build the Mongolia model runner """ import os import yaml from autumn.model_runner import build_model_runner from autumn.tool_kit.utils import merge_dicts from .model import build_model FILE_DIR = os.path.dirname(os.path.abspath(__file__)) PARAMS_PATH = os.path.join(FILE_DIR, "params.yml") MLE_PARAMS_PATH = os.path.join(FILE_DIR, "params-mle.yml") POST_PROCESSING_PATH = os.path.join(FILE_DIR, "post-processing.yml") PLOTS_PATH = os.path.join(FILE_DIR, "plots.yml") with open(PARAMS_PATH, "r") as f: params = yaml.safe_load(f) with open(MLE_PARAMS_PATH, "r") as f: mle_params = yaml.safe_load(f) # Incorporate max likelihood params from MCMC runs params["default"] = merge_dicts(mle_params, params["default"]) run_model = build_model_runner( model_name="mongolia", param_set_name=None, build_model=build_model, params=params )
""" Build the Marshall Islands model runner """ import os import yaml from autumn.model_runner import build_model_runner from . import calibration from .model import build_model FILE_DIR = os.path.dirname(os.path.abspath(__file__)) PARAMS_PATH = os.path.join(FILE_DIR, "params.yml") POST_PROCESSING_PATH = os.path.join(FILE_DIR, "post-processing.yml") PLOTS_PATH = os.path.join(FILE_DIR, "plots.yml") with open(PARAMS_PATH, "r") as f: params = yaml.safe_load(f) run_model = build_model_runner( model_name="marshall_islands", param_set_name=None, build_model=build_model, params=params, )
""" import os import yaml from autumn.model_runner import build_model_runner from .model import build_model FILE_DIR = os.path.dirname(os.path.abspath(__file__)) PARAMS_PATH = os.path.join(FILE_DIR, "params.yml") POST_PROCESSING_PATH = os.path.join(FILE_DIR, "post-processing.yml") PLOTS_PATH = os.path.join(FILE_DIR, "plots.yml") with open(PARAMS_PATH, "r") as f: params = yaml.safe_load(f) with open(POST_PROCESSING_PATH, "r") as f: pp_config = yaml.safe_load(f) with open(PLOTS_PATH, "r") as f: plots_config = yaml.safe_load(f) run_model = build_model_runner( model_name="marshall_islands", build_model=build_model, params=params, post_processing_config=pp_config, plots_config=plots_config, )
from .model import build_model FILE_DIR = os.path.dirname(os.path.abspath(__file__)) PARAMS_PATH = os.path.join(FILE_DIR, "params.yml") MLE_PARAMS_PATH = os.path.join(FILE_DIR, "params-mle.yml") POST_PROCESSING_PATH = os.path.join(FILE_DIR, "post-processing.yml") PLOTS_PATH = os.path.join(FILE_DIR, "plots.yml") with open(PARAMS_PATH, "r") as f: params = yaml.safe_load(f) with open(MLE_PARAMS_PATH, "r") as f: mle_params = yaml.safe_load(f) # Incorporate max likelihood params from MCMC runs params["default"] = merge_dicts(mle_params, params["default"]) with open(POST_PROCESSING_PATH, "r") as f: pp_config = yaml.safe_load(f) with open(PLOTS_PATH, "r") as f: plots_config = yaml.safe_load(f) run_model = build_model_runner( model_name="mongolia", build_model=build_model, params=params, post_processing_config=pp_config, plots_config=plots_config, )