Beispiel #1
0
def generate_forecasts(start_date, location, forecast_horizon):
    model_type = covid.models.SEIRD_incident.SEIRD
    
    util.gen_forecasts(data,
                       location,
                       model_type=model_type,
                       start=start_date,
                       end=None,
                       save=True,
                       show=False,
                       forecast_horizon=forecast_horizon)

# def get_final_r0(start_date, location):
#     zz = util.get_R_final(data,
#                    place,
#                    model_type=model_type,
#                    start=start,
#                    end=end,
#                    save=save,
#                    forecast_horizon=25)
Beispiel #2
0
    parser = argparse.ArgumentParser(description='Run Bayesian compartmental models.')
    parser.add_argument('place', help='place to use (e.g., US state)')
    parser.add_argument('--start', help='start date', default='2020-03-04')
    parser.add_argument('--end', help='end date', default=None)
    parser.add_argument('--prefix', help='path prefix for saving results', default='results')
    parser.add_argument('--config', help='model configuration name', default='SEIRD')
    
    args = parser.parse_args()

    if args.config not in dir(configs):
        print(f'Invalid config: {args.config}. Options are {dir(configs)}')
        exit()

    config = getattr(configs, args.config)
        
    data = util.load_data()
    
    util.run_place(data,
                   args.place,
                   start=args.start,
                   end=args.end,
                   prefix=args.prefix,
                   model_type=config['model'],
                   **config['args'])
    
    util.gen_forecasts(data,
                       args.place,
                       start=args.start,
                       prefix=args.prefix,
                       show=False)
Beispiel #3
0
    parser.add_argument('--config',
                        help='model configuration name',
                        default='SEIRD')
    parser.set_defaults(run=True)

    args = parser.parse_args()

    if args.config not in dir(configs):
        print(f'Invalid config: {args.config}. Options are {dir(configs)}')
        exit()

    config = getattr(configs, args.config)

    data = util.load_data()

    if args.run:
        util.run_place(data,
                       args.place,
                       start=args.start,
                       end=args.end,
                       prefix=args.prefix,
                       model_type=config['model'],
                       **config['args'])

    util.gen_forecasts(data,
                       args.place,
                       start=args.start,
                       prefix=args.prefix,
                       model_type=config['model'],
                       show=False)