def test_create_pivot_plot(self):
        x, outcomes = utilities.load_flu_data()
        y = outcomes['deceased population region 1'][:, -1] > 1000000

        dimensional_stacking.create_pivot_plot(x, y, 2)
        dimensional_stacking.create_pivot_plot(x, y, 2, labels=False,
                                               bin_labels=True )
        dimensional_stacking.create_pivot_plot(x, y, 1, labels=False)
        plt.draw()
        plt.close('all')
예제 #2
0
'''

This file illustrated the use of the workbench for using dimensional
stacking for scenario discovery


.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>

'''
import matplotlib.pyplot as plt

from ema_workbench import ema_logging, load_results
from ema_workbench.analysis import dimensional_stacking

ema_logging.log_to_stderr(level=ema_logging.INFO)

# load data
fn = './data/1000 flu cases no policy.tar.gz'
x, outcomes = load_results(fn)

y = outcomes['deceased population region 1'][:, -1] > 1000000

fig = dimensional_stacking.create_pivot_plot(x, y, 2, bin_labels=True)

plt.show()
x = experiments1.iloc[:, 0:50]
y = pd.DataFrame.from_dict(outcomes1)

fs = feature_scoring.get_feature_scores_all(x, y)
sns.heatmap(fs, cmap='viridis', annot=True)
plt.show()
plt.savefig('feature scoring.png')

#%% dimensional stacking

from ema_workbench.analysis import dimensional_stacking

x = experiments1.iloc[:, 0:50]
outcomesdf = pd.DataFrame.from_dict(outcomes1)
y = outcomesdf['Expected Number of Deaths'] < 1.0
dimensional_stacking.create_pivot_plot(x, y, 2, nbins=3)
plt.show()
plt.savefig('dimensional stacking.png')

#%% sensitivity analysis

from ema_workbench.analysis import regional_sa
from numpy.lib import recfunctions as rf

sns.set_style('white')

# model is the same across experiments
x = experiments1.iloc[:, 0:50]
y = outcomesdf['Expected Number of Deaths'] < 1.0
fig = regional_sa.plot_cdfs(x, y)
sns.despine()
예제 #4
0
a PRIM analysis.

The data was generated using a system dynamics models implemented in Vensim.
See flu_example.py for the code. The dataset was generated using 32 bit Python.
Therefore, this example will not work if you are running 64 bit Python. 


.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
                chamarat <c.hamarat  (at) tudelft (dot) nl>

'''
from __future__ import (division, print_function, unicode_literals)
import matplotlib.pyplot as plt

from ema_workbench import ema_logging, load_results
from ema_workbench.analysis import dimensional_stacking

ema_logging.log_to_stderr(level=ema_logging.INFO)

# load data
fn = './data/1000 flu cases no policy.tar.gz'
x, outcomes = load_results(fn)

y = outcomes['deceased population region 1'][:, -1] > 1000000

fig = dimensional_stacking.create_pivot_plot(x, y, 2)

fig.set_size_inches(6, 6)

plt.show()
'''

This file illustrated the use of the workbench for doing 
a PRIM analysis.

The data was generated using a system dynamics models implemented in Vensim.
See flu_example.py for the code. The dataset was generated using 32 bit Python.
Therefore, this example will not work if you are running 64 bit Python. 


.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
                chamarat <c.hamarat  (at) tudelft (dot) nl>

'''
from __future__ import (division, print_function, unicode_literals)
import matplotlib.pyplot as plt

from ema_workbench import ema_logging, load_results
from ema_workbench.analysis import dimensional_stacking

ema_logging.log_to_stderr(level=ema_logging.INFO)

# load data
fn = './data/1000 flu cases no policy.tar.gz'
x, outcomes = load_results(fn)

y = outcomes['deceased population region 1'][:, -1] > 1000000

dimensional_stacking.create_pivot_plot(x, y, 2)
plt.show()