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