Exemplo n.º 1
0
def test_pairs_scatter():
    experiments, outcomes = utilities.load_eng_trans_data()
    
    pairs_scatter(experiments, outcomes)
    
    pairs_scatter(experiments, outcomes, group_by='policy',
                  grouping_specifiers='basic policy', legend=False)
    
    pairs_scatter(experiments, outcomes, group_by='policy', 
                  grouping_specifiers=['no policy', 'adaptive policy'])
    plt.draw()
    plt.close('all')
def test_pairs_scatter():
    results = test_utilities.load_eng_trans_data()
    
    pairs_scatter(results)
    
    pairs_scatter(results, group_by='policy',
                  grouping_specifiers='basic policy', legend=False)
    
    pairs_scatter(results, group_by='policy', 
                  grouping_specifiers=['no policy', 'adaptive policy'])
    plt.draw()
    plt.close('all')
def test_pairs_scatter():
    results = test_utilities.load_eng_trans_data()

    pairs_scatter(results)

    pairs_scatter(results,
                  group_by='policy',
                  grouping_specifiers='basic policy',
                  legend=False)

    pairs_scatter(results,
                  group_by='policy',
                  grouping_specifiers=['no policy', 'adaptive policy'])
    plt.draw()
    plt.close('all')
def test_pairs_scatter():
    experiments, outcomes = utilities.load_eng_trans_data()

    pairs_scatter(experiments, outcomes)

    pairs_scatter(experiments,
                  outcomes,
                  group_by='policy',
                  grouping_specifiers='basic policy',
                  legend=False)

    pairs_scatter(experiments,
                  outcomes,
                  group_by='policy',
                  grouping_specifiers=['no policy', 'adaptive policy'])
    plt.draw()
    plt.close('all')
                                                policies=4,
                                                levers_sampling=MC)

        #####################################################################################################

        # process the results of the experiments
        experiments, outcomes = results
    print(experiments.shape)
    print(list(outcomes.keys()))
    stop = time.time()
    print(f"Runtime in minutes: { ((stop-start)/60) }")

    from ema_workbench.analysis import pairs_plotting

    fig, axes = pairs_plotting.pairs_scatter(experiments,
                                             outcomes,
                                             group_by='policy',
                                             legend=False)
    hue = 'policy'
    fig.set_size_inches(8, 8)
    plt.show()

##PLOTTEN LUKT NIET
# from ema_workbench.analysis import plotting, plotting_util
#
#
# for outcome in outcomes.keys():
#     plotting.lines(experiments, outcomes, outcomes_to_show=outcome,
#                density=plotting_util.Density.HIST)
# plt.show()

# # Printing as done on workbench website example
Exemplo n.º 6
0
# load the data
fh = './data/1000 flu cases no policy.tar.gz'
experiments, outcomes = load_results(fh)

# transform the results to the required format
# that is, we want to know the max peak and the casualties at the end of the
# run
tr = {}

# get time and remove it from the dict
time = outcomes.pop('TIME')

for key, value in outcomes.items():
    if key == 'deceased population region 1':
        tr[key] = value[:, -1]  #we want the end value
    else:
        # we want the maximum value of the peak
        max_peak = np.max(value, axis=1)
        tr['max peak'] = max_peak

        # we want the time at which the maximum occurred
        # the code here is a bit obscure, I don't know why the transpose
        # of value is needed. This however does produce the appropriate results
        logical = value.T == np.max(value, axis=1)
        tr['time of max'] = time[logical.T]

pairs_scatter((experiments, tr), filter_scalar=False)
pairs_lines((experiments, outcomes))
pairs_density((experiments, tr), filter_scalar=False)
plt.show()
Exemplo n.º 7
0
# load the data
fh = r'.\data\1000 flu cases no policy.tar.gz'
experiments, outcomes = load_results(fh)

# transform the results to the required format
# that is, we want to know the max peak and the casualties at the end of the 
# run
tr = {}

# get time and remove it from the dict
time = outcomes.pop('TIME')

for key, value in outcomes.items():
    if key == 'deceased population region 1':
        tr[key] = value[:,-1] #we want the end value
    else:
        # we want the maximum value of the peak
        max_peak = np.max(value, axis=1) 
        tr['max peak'] = max_peak
        
        # we want the time at which the maximum occurred
        # the code here is a bit obscure, I don't know why the transpose 
        # of value is needed. This however does produce the appropriate results
        logical = value.T==np.max(value, axis=1)
        tr['time of max'] = time[logical.T]
        
pairs_scatter((experiments, tr), filter_scalar=False)
pairs_lines((experiments, outcomes))
pairs_density((experiments, tr), filter_scalar=False)
plt.show()