Beispiel #1
0
def get_label():
    pad = 24

    data_dict = data_loader.get_data_pyro(countries,
                                          smart_start=False,
                                          pad=pad,
                                          rebuttal=True)

    data_dict = smooth_daily(data_dict)
    test_start = [str(x.date())
                  for x in list(data_dict['date_list'])].index('2020-04-25')
    test_len = 30
    actual_14 = data_dict['actual_daily_death'][test_start:test_start +
                                                test_len].numpy()
    eval_days = [
        str(data_dict['date_list'][test_start].date() + timedelta(days=x))
        for x in range(test_len)
    ]
    return actual_14, eval_days
Beispiel #2
0
args = parser.parse_args()
days = int(args.days)

register_matplotlib_converters()
countries = [
    'United Kingdom', 'Italy', 'Germany', 'Spain', 'US', 'France', 'Belgium',
    'Korea, South', 'Brazil', 'Iran', 'Netherlands', 'Canada', 'Turkey',
    'Romania', 'Portugal', 'Sweden', 'Switzerland', 'Ireland', 'Hungary',
    'Denmark', 'Austria', 'Mexico', 'India', 'Ecuador', 'Russia', 'Peru',
    'Indonesia', 'Poland', 'Philippines', 'Japan', 'Pakistan'
]

niter = 2000
n_sample = 500
pad = 24
data_dict = data_loader.get_data_pyro(countries, smart_start=False, pad=pad)
data_dict = pyro_model.helper.smooth_daily(data_dict)

train_len = data_dict['cum_death'].shape[0] - days
n_country = len(countries)

covariates_notime = pyro_model.helper.get_covariates_intervention(data_dict,
                                                                  train_len,
                                                                  notime=True)
Y_train = pyro_model.helper.get_Y(data_dict, train_len)

total_len = len(data_dict['date_list'])
covariates_full_notime = pyro_model.helper.get_covariates_intervention(
    data_dict, total_len, notime=True)
Y_full = pyro_model.helper.get_Y(data_dict, total_len)
Y_daily = data_dict['daily_death']
        'country_feat': data_dict['country_feat']
    }


countries = [
    'United Kingdom', 'Italy', 'Germany', 'Spain', 'US', 'France', 'Belgium',
    'Korea, South', 'Brazil', 'Iran', 'Netherlands', 'Canada', 'Turkey',
    'Romania', 'Portugal', 'Sweden', 'Switzerland', 'Ireland', 'Hungary',
    'Denmark', 'Austria', 'Mexico', 'India', 'Ecuador', 'Russia', 'Peru',
    'Indonesia', 'Poland', 'Philippines', 'Japan', 'Pakistan'
]

pad = 24

data_dict = data_loader.get_data_pyro(countries,
                                      smart_start=False,
                                      pad=pad,
                                      rebuttal=True)

data_dict = smooth_daily(data_dict)

test_start = [str(x.date())
              for x in list(data_dict['date_list'])].index('2020-04-25')

test_len = 30

actual_14 = data_dict['actual_daily_death'][test_start:test_start +
                                            test_len].numpy()

eval_days = [
    str(data_dict['date_list'][test_start].date() + timedelta(days=x))
    for x in range(test_len)
    'Portugal',
    'Sweden',
    'Switzerland',
    'Ireland',
    'Hungary',
    'Denmark',
    'Austria',
    'Poland',
]

model_id = 'testing'
days = 14
niter = 500
n_sample = 1000

data_dict = data_loader.get_data_pyro(countries)
data_dict = pyro_model.helper.smooth_daily(data_dict)

train_len = data_dict['cum_death'].shape[0] - days
n_country = len(countries)

covariates_notime = pyro_model.helper.get_covariates_intervention(data_dict,
                                                                  train_len,
                                                                  notime=True)
Y_train = data_dict['actual_cum_death'][:train_len, :]

total_len = len(data_dict['date_list'])
covariates_full_notime = pyro_model.helper.get_covariates_intervention(
    data_dict, total_len, notime=True)
Y_full = data_dict['actual_cum_death'][:total_len, :]
Y_daily = data_dict['actual_daily_death']