feature_scoring_flu.py

 1"""
 2Created on 30 Oct 2018
 3
 4@author: jhkwakkel
 5"""
 6
 7import matplotlib.pyplot as plt
 8import numpy as np
 9import seaborn as sns
10
11from ema_workbench import ema_logging, load_results
12from ema_workbench.analysis import feature_scoring
13
14ema_logging.log_to_stderr(level=ema_logging.INFO)
15
16# load data
17fn = r"./data/1000 flu cases with policies.tar.gz"
18x, outcomes = load_results(fn)
19
20# we have timeseries so we need scalars
21y = {
22    "deceased population": outcomes["deceased_population_region_1"][:, -1],
23    "max. infected fraction": np.max(outcomes["infected_fraction_R1"], axis=1),
24}
25
26scores = feature_scoring.get_feature_scores_all(x, y)
27sns.heatmap(scores, annot=True, cmap="viridis")
28plt.show()