sd_logit_flu_example.py

 1"""
 2
 3"""
 4
 5import matplotlib.pyplot as plt
 6import seaborn as sns
 7
 8import ema_workbench.analysis.logistic_regression as logistic_regression
 9from ema_workbench import load_results
10
11# Created on 14 Mar 2019
12#
13# .. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
14
15
16experiments, outcomes = load_results("./data/1000 flu cases no policy.tar.gz")
17
18x = experiments.drop(["model", "policy"], axis=1)
19y = outcomes["deceased_population_region_1"][:, -1] > 1000000
20
21logit = logistic_regression.Logit(x, y)
22logit.run()
23
24logit.show_tradeoff()
25
26# when we change the default threshold, the tradeoff curve is
27# recalculated
28logit.threshold = 0.8
29logit.show_tradeoff()
30
31# we can also look at the tradeoff across threshold values
32# for a given model
33logit.show_threshold_tradeoff(3)
34
35# inspect shows the threshold tradeoff for the model
36# as well as the statistics of the model
37logit.inspect(3)
38
39# we can also visualize the performance of the model
40# using a pairwise scatter plot
41sns.set_style("white")
42logit.plot_pairwise_scatter(3)
43
44plt.show()