def run_phase_1(model, region, n_samples, params): model_class = import_from('epidemics.' + model, 'Model') params['country'] = region print('[Phase 1] Running {}'.format(region)) a = model_class(**params) a.sample(n_samples) a.propagate() a.save() a.plot_intervals(ns=20)
def propagation(model, region, phase_3_path): n_samples = 1 dataFolder = phase_3_path params = { 'dataFolder': dataFolder, 'preprocess': True, 'nThreads': 12, 'nPropagation': 100, 'futureDays': 2, 'nValidation': 0, 'percentages': [0.5, 0.95, 0.99], 'silent': False } model_class = import_from('epidemics.' + model, 'Model') params['country'] = region a = model_class(**params) a.load_parameters(phase_3_path + '/_korali_samples/') a.propagate() a.save() a.plot_intervals(ns=20)
type=int, default=0, help= 'Use that many data from the end of the data list to validate the prediction.' ) parser.add_argument('--percentages', '-p', nargs='+', type=float, default=[0.5, 0.95, 0.99], help='Percentages for confidence intervals.') parser.add_argument('--silent', action='store_true', help='No output on screen.') parser.add_argument('--silentPlot', '-sp', action='store_true', help='Close plot window after plot.') args = parser.parse_args() x = copy.deepcopy(args) del x.compModel del x.nSamples del x.nGenerations model_class = import_from('epidemics.' + args.compModel, 'Model') a = model_class(**vars(x)) a.least_squares(args.nGenerations)
default='switzerland', help='Country from which to retrieve data./') parser.add_argument('--lastDay', '-ld', default='2020-06-15', help='Last day of data sequence in format %Y-%m-%d./') parser.add_argument('--silentPlot', '-sp', action='store_true', help='Close plot window after plot.') parser.add_argument('--preprocess', '-pre', type=bool, default=False, help='Preprocessing.') args = parser.parse_args() obs = [] obs.append('infections') obs.append('deaths') x = copy.deepcopy(args) x.observations = obs model_class = import_from('epidemics.country.reparam.sird_int.nbin', 'Model') a = model_class(**vars(x)) a.fit_curve()