hyunjimoon / VaccineMisinf

2 stars 0 forks source link

plot feedback #15

Open hyunjimoon opened 1 year ago

hyunjimoon commented 1 year ago

To. Oriol

structure

Starting with 69 .csvs, (3(counterfactual of vaccine amount) *23(parameters) for sensitivity calculation), I store them and plot: image

Writing test codes

        vv["x1_pcth1"] = vv["x1_pcsth1"].sum(dim="space") # TODO: compare same value 
        vv["x2_pnth1"] = vv["x2_pnsth1"].sum(dim="space")
        # print("VERIFY1: vensim-xarray space aggregation is same")
        # print("VENSIM :", paramvv["Cost of Deaths Cumulative All"].values.flatten())
        # print("xarray :", vv["x1_pcth1"].values)

dims, coords

code

# x
x1 = ["cost"]
x2 = ["population"]

# function
f1x = ["mvv", "avv"] #better if functional form
f2x = ["mvv_sens", "avv_sens"]

# param
t_sharing_sbatched_params, ts_sharing_params  = gen_param_names()[1:]
param_lst = t_sharing_sbatched_params + ts_sharing_params + ["baseline"]

# component_time_vec
costcomp_tv = ['death', 'gdp', 'hospitalization']
noncostcomp_tv = ['population']
# space
state_names  = gen_param_names()[0]

# time
time = pd.date_range(start='10/15/2019', periods=1071)

# hyperparameter/action/counterfactual
vax_amt_lst = [1.01, 1, 0]
vax_time_lst = [range(-50, 60, 10)]

dv = {
    "dims": {"x1", "x2", "f1x", "f2x", "param", "costcomp_tv", "noncostcomp_tv", "space", "time", "hp_vax_amt", "hp_vax_time"}, #action as hparam
    "coords": { #pcstvh
        'x1': {"dims": ("x1"), "data": x1}, #COST ($) TODO: if I use ["cost"], should i change x1_pcsth1 as "x1" or "cost"?
        'x2': {"dims": ("x2"), "data": x2}, #POPULATION (person)

        'f1x': {"dims": ("f1x"), "data": f1x}, #MARGINAL AVERAGE VACCINE VALUE PER PERSON ($/person)
        'f2x': {"dims": ("f2x"), "data": f2x}, #MARGINAL AVERAGE VACCINE VALUE PER PERSON w.r.t. PARAMETER ($/person/punit)

        'param': {"dims": ("param"), "data": param_lst},

        'costcomp_tv': {"dims": ("costcomp_tv"), "data": costcomp_tv},
        'noncostcomp_tv': {"dims": ("noncostcomp_tv"), "data": noncostcomp_tv},

        'space': {"dims": ("space"), "data": state_names},
        'time': {"dims": ("time"), "data": time},
        'hp_vax_amt': {"dims": ("hp_vax_amt"), "data": [str(va) for va in vax_amt_lst]},
        'hp_vax_time': {"dims": ("hp_vax_time"), "data": [str(vt) for vt in vax_time_lst]}
    },
    "data_vars": {  # 5+3 three vdot_ coordinate is only needed for data variables with 'p' coordinate
        "x1_pcsth1": {"dims": ("x1", "param", "costcomp_tv", "space", "time", "hp_vax_amt"), "data": np.zeros(shape=(len(x1), len(param_lst), len(costcomp_tv), len(state_names), len(time), len(vax_amt_lst)))}, # vaccine value for each component, space, time, for vaxinc 0, 1, 1.01
        "x2_pnsth1": {"dims": ("x2", "param", "noncostcomp_tv", "space", "time", "hp_vax_amt"), "data": np.zeros(shape=(len(x2), len(param_lst), len(noncostcomp_tv), len(state_names), len(time), len(vax_amt_lst)))},

        "x1_cth2": {"dims": ("x1","costcomp_tv", "time", "hp_vax_time"), "data": np.zeros(shape=(len(x1),len(costcomp_tv), len(time), len(vax_time_lst)))},

        "f1x_pcsth1": {"dims": ("f1x", "param", "costcomp_tv", "space", "time","hp_vax_amt"), "data": np.zeros(shape=(len(f1x), len(param_lst), len(costcomp_tv),  len(state_names), len(time), len(vax_amt_lst)))}, #marginal vaccine value per person
        "f2x_pcst": {"dims": ("f2x", "param", "costcomp_tv", "space", "time",), "data": np.zeros(shape=(len(f2x), len(param_lst), len(costcomp_tv),  len(state_names), len(time)))}, #marginal vaccine value per person w.r.t. parameter
    },
    "attrs": {"title": "1.vaccine value disaggregated by parameter, time, space, component, 2.counterfactual by parameter for validity, 3.counterfactual by datahp for summary stat."}
    # 1 and 2 are descriptive, 3 is prescriptive
}
vv = xr.Dataset.from_dict(dv)

image

hyunjimoon commented 1 year ago

To hazhir: For plotting, the first iteration included several manual .csv-export inside vensim. One-touch workflow would be ideal but full automation may not be our best strategy considering the time constraints. Due to stanify experience, Angie is not determined for full automation, before learning more about reviewers' interests and user base for vensim-python.

Noted below are plot improvement suggestions (conservative required time) for each automation and Angie needs feedback on prioritization as presentable quality for the ISDC conference is our communal goal. Due to previous commitments, for this week, Angie has 3hrs on Wednesday and [Batman and Angie] has 2-3hrs on next Sunday (16th). If you need, Angie can try rearranging schedule for next week, but with your kind understanding 4hrs every other two weeks is sustainable for future reference.

tf5_mavv_by_t

image
  1. improve plot: remove infection + plot three state time-series do we want real vs simulated time series comparison for death, hospitalization for aggregated state or three big states (like GDP)?