numpyro.set_host_device_count(args.num_chains) if __name__ == "__main__": print(f"Running Sensitivity Analysis {__file__} with config:") config = load_model_config(args.model_config) pprint_mb_dict(config) print("Loading Data") data = preprocess_data(get_data_path()) data.featurize(**config["featurize_kwargs"]) data.mask_new_variant( new_variant_fraction_fname=get_new_variant_path(), ) data.mask_from_date("2021-01-09") print("Loading EpiParam") ep = EpidemiologicalParameters() model_func = get_model_func_from_str(args.model_type) ta = get_target_accept_from_model_str(args.model_type) td = get_tree_depth_from_model_str(args.model_type) base_outpath = generate_base_output_dir( args.model_type, args.model_config, args.exp_tag ) ts_str = datetime.now().strftime("%Y-%m-%d;%H:%M:%S") summary_output = os.path.join(base_outpath, f"{ts_str}_summary.json") full_output = os.path.join(base_outpath, f"{ts_str}_full.netcdf") model_build_dict = config["model_kwargs"] posterior_samples, _, info_dict, _ = run_model(
numpyro.set_host_device_count(args.num_chains) if __name__ == "__main__": print(f"Running Sensitivity Analysis {__file__} with config:") config = load_model_config(args.model_config) pprint_mb_dict(config) print("Loading Data") data = preprocess_data(get_data_path()) data.featurize(**config["featurize_kwargs"]) data.mask_new_variant(new_variant_fraction_fname=get_new_variant_path(), ) data.mask_from_date("2021-01-09") print("Loading EpiParam") ep = EpidemiologicalParameters() # shift delays ep.generation_interval["mean"] = (ep.generation_interval["mean"] + args.gen_int_mean_shift) ep.onset_to_death_delay["mean"] = (ep.onset_to_death_delay["mean"] + args.death_delay_mean_shift) ep.onset_to_case_delay["mean"] = (ep.onset_to_case_delay["mean"] + args.cases_delay_mean_shift) ep.generate_delays() model_func = get_model_func_from_str(args.model_type) ta = get_target_accept_from_model_str(args.model_type)
r0_scale = np.clip(0.3 + 0.1 * np.random.normal(), a_min=0.1, a_max=0.5) rw_period = np.random.choice([5, 7, 9, 11, 14]) n_days_seeding = np.random.choice([5, 7, 9, 11, 14]) print("Loading Data") data = preprocess_data(get_data_path()) data.featurize(**config["featurize_kwargs"]) data.mask_new_variant( new_variant_fraction_fname=get_new_variant_path(), maximum_fraction_voc=float(max_frac_voc), ) data.mask_from_date("2021-01-09") print("Loading EpiParam") ep = EpidemiologicalParameters() # shift delays ep.generation_interval["mean"] = (ep.generation_interval["mean"] + gi_shift) ep.onset_to_death_delay["mean"] = (ep.onset_to_death_delay["mean"] + dd_shift) ep.onset_to_case_delay["mean"] = (ep.onset_to_case_delay["mean"] + cd_shift) ep.generate_delays() model_func = get_model_func_from_str(args.model_type) ta = get_target_accept_from_model_str(args.model_type)