<jupyter_start><jupyter_text>def set_pub():    mpl.rcdefaults()    mpl.rcParams['font.size'] = 14    mpl.rcParams['font.weight'] = 'bold'    mpl.rcParams['xtick.labelsize'] = 'xx-large'    mpl.rcParams['ytick.labelsize'] = 'xx-large'    mpl.rcParams['figure.titlesize'] = 'xx-large'    mpl.rcParams['legend.fontsize'] = 'xx-large'    mpl.rcParams['axes.titlesize'] = 'xx-large'    mpl.rcParams['axes.titleweight'] = 'bold'    mpl.rcParams['axes.labelsize'] = 'xx-large'    mpl.rcParams['axes.labelweight'] = 'bold'    mpl.rcParams['lines.linewidth'] = 3    mpl.rcParams['lines.markersize'] = 12    print(mpl.rcParams['figure.titlesize'], mpl.rcParams['legend.fontsize'])    plt.rc('figure', dpi=500)set_pub()<jupyter_code>import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import pyplot
import numpy as np
plt.rcParams.update({'figure.max_open_warning': 0})
from IPython.display import display, HTML
font = {'family' : 'normal',
        'weight' : 'bold',
        'size'   : 30}

mpl.rc('font', **font)
import os
ls_all_csv = os.listdir(all_csv_path)
ls_all_csv
mb = [0,1,6, ]
cb = [4,5,7,8, 11,12]
mbcb = [2,3, 9, 10 ]
def return_df(df, file, val):
    ls = ['best_svr', 'best_lr', 'best_rr', 'best_knn', 'best_gpr','best_dt','best_rf','best_etr',
          'best_gbr', 'best_xgb','best_dnn']
    new_df = pd.DataFrame(columns = ls) 
    for i in range(len(ls)):
        arr = [float(s) for s in df[val][i][1:-1].split(',')]
        new_df[ls[i]] = arr
    return new_df<jupyter_output><empty_output><jupyter_text>R2 Score<jupyter_code>df_set_r2 = [] 
for file in ls_all_csv:
    df = pd.read_csv(all_csv_path + '\\' + file)
    df_set_r2.append(return_df(df, file, val = 'r2'))
df_set_mape = [] 
for file in ls_all_csv:
    df = pd.read_csv(all_csv_path + '/' + file)
    df_set_mape.append(return_df(df, file, val = 'mape'))
df_set_mse = [] 
for file in ls_all_csv:
    df = pd.read_csv(all_csv_path + '/' + file)
    # print(df.head())
    # break
    df_set_mse.append(return_df(df, file, val = 'mse'))
len(df_set_mape)<jupyter_output><empty_output><jupyter_text>R2 Values for all datasets<jupyter_code>for i in range(13):
    print('Data for', ls_all_csv[i])
    display(df_set_r2[i])<jupyter_output>Data for dijkstra_physical.csv<jupyter_text>APE Values for all datasets<jupyter_code>for i in range(13):
    print('Data for', ls_all_csv[i])
    display(df_set_mape[i])<jupyter_output>Data for dijkstra_physical.csv<jupyter_text>MSE Values for all datasets<jupyter_code>for i in range(13):
    print('Data for', ls_all_csv[i])
    display(df_set_mse[i])
def find_y_r2(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y.append(np.mean(y_temp))
    # print(y)    
    return y
def find_y_mape(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.median(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
def find_y_mse(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        # y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.mean(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
'''cb = [2,3,4,5,6]
mb = [0,1,7,8]
mb+cb = []'''
ls_all_csv<jupyter_output><empty_output><jupyter_text>Mean R2 and Median APE values for all models  Compute Bound Fig 6<jupyter_code>dataset_names = ['Dijkstra_Physical', 'Dijsktra_Simulated', 'Quick_Sort_Physical', 'Quick_Sort_Simulated', 
                 'Mantevo_miniFE_Physical', 'NPB_EP_Physical', 'NPB_MG_Physical', 'SHA_Physical', 
                 'SHA_Simulated', 'Stitch_Physical', 'Stitch_Simulated', 'SVM_Physical', 'SVM_Simulated' ]
dataset_names, len(dataset_names)
mb,cb,mbcb
sum_r2 = 0
for j in range(len(cb)):
    color = 'tab:red'
    y_r2 = find_y_r2(df_set_r2[cb[j]])
    print(y_r2)
    print('Mean R2 Values for dataset:', dataset_names[cb[j]], np.mean(y_r2[5:10]),  '\n')
    sum_r2 = sum_r2 + np.mean(y_r2[5:10])
    # y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
print(sum_r2/6)    
sum_mape = 0
for j in range(len(cb)):
    color = 'tab:red'
    y_mape = find_y_mape(df_set_mape[cb[j]])
    print('Mean R2 Values for dataset:', dataset_names[cb[j]], np.mean(y_mape[5:10]),  '\n')
    sum_mape = sum_mape + np.mean(y_mape[5:10])
    # y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
print(sum_mape/6)    
ls = ['svr', 'lr', 'rr', 'knn', 'gpr','dt','rf','etr',
          'gbr', 'xgb','dnn']
fig, ax = plt.subplots(1,1, figsize = (11, 8)) # create 2x2 array of subplots
k = 0
dataset = ['d1','d2','d3','d4','d5','d6','d7', 'd8', 'd9']
for j in range(len(cb)):
    j = 5
    color = 'tab:red'
    y_r2 = find_y_r2(df_set_r2[cb[j]])
    # print('Mean R2 Values for dataset:', dataset_names[cb[j]],y_r2,  '\n')
    y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
    # px = ax[i,j].plot(y_r2, patch_artist = True) # add boxplot to 1st subplot
    px = ax.bar(ls,y_r2,color = 'springgreen', label = 'R2')
    ax.legend(frameon=True, loc='upper left', prop={'size': 20})

    # ax[i,j].bar(ls, y,color = 'blue')
    ax.set_xticklabels(ls, rotation = 90, fontsize = 35)

    # if j == 4:
    #    ax[i,j].set_ylabel('MedAPE score')
    # ax.set_title(dataset_names[cb[j]] + ' (' + dataset[cb[j]] + ')', fontsize = 25, fontweight = 'bold') 
    ax.set_ylim(-0.5,1.5)

    ax.grid()


    ax_temp = ax.twinx()  # instantiate a second axes that shares the same x-axis
    line2 = ax_temp.plot(ls,y_mape,'--bo', color = 'blue',label='MedAPE score') # add boxplot to 1st subplot
    # line, = ax.plot([1, 2, 3], label='Inline label')
    ax_temp.legend(frameon= True, loc='upper right', prop={'size': 20})
    # ax_temp.boxplot(y_mape,labels = ls)
    # ax[i,j].bar(ls, y,color = 'blue')
    ax_temp.set_xticklabels(ls, rotation = 90)
    # ax_temp.set_yticklabels(fontsize = 15)
    ax_temp.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
    # ax_temp.legend(['MedAPE score'])

    fig.tight_layout()  # otherwise the right y-label is slightly clipped
    ax_temp.set_ylim(-10,100)

    # plt.show()
    # extent = ax.get_tightbbox(fig.canvas.get_renderer()).transformed(fig.dpi_scale_trans.inverted())
    # fig.savefig('cb_1.pdf', bbox_inches = extent)
    name = 'cb' + '_' + str(j)
    # fig.savefig(name+ '.eps', bbox_inches=extent.expanded(1.2, 1.15))
    plt.rc('font', size = 25)
    fig.savefig(name+ '.eps')

    break
    k = k + 1
    # df.boxplot(column='price', by='bedrooms', ax=axes[0,1]) # add boxplot to 2nd subplot
    # colors = ['pink', 'lightblue', 'lightgreen', 'red', 'purple', 'yellow','green', 'blue', 'brown', 'cyan', 
    #          'crimson','crimson','crimson','crimson'] 
    # for patch, color in zip(px['boxes'], colors):
    #        patch.set_facecolor(color)
    # leg = ax.legend();
    # etc.
    # fig.legend(['R2 Score'])
    # fig.legend(['MedAPE Score'])
# ax.tick_params(axis='both', which='major', labelsize=10)
# ax.tick_params(axis='both', which='minor', labelsize=8)    
fig.show()
# plt.savefig('cb.pdf', bbox_inches = 'tight')<jupyter_output>findfont: Font family ['normal'] not found. Falling back to DejaVu Sans.
findfont: Font family ['normal'] not found. Falling back to DejaVu Sans.
findfont: Font family ['normal'] not found. Falling back to DejaVu Sans.
The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
C:\Users\Rajat\Anaconda3\lib\site-packages\ipykernel_launcher.py:63: UserWarning: Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure.<jupyter_text>Memory Bound Fig 7<jupyter_code>sum_r2 = 0
for j in range(len(mb)):
    color = 'tab:red'
    y_r2 = find_y_r2(df_set_r2[mb[j]])
    print(y_r2)
    print('Mean R2 Values for dataset:', dataset_names[mb[j]], np.mean(y_r2[5:10]),  '\n')
    sum_r2 = sum_r2 + np.mean(y_r2[5:10])
    # y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
print(sum_r2/3)    
sum_mape = 0
for j in range(len(mb)):
    color = 'tab:red'
    y_mape = find_y_mape(df_set_mape[mb[j]])
    print('Mean R2 Values for dataset:', dataset_names[mb[j]], np.mean(y_mape[5:10]),  '\n')
    sum_mape = sum_mape + np.mean(y_mape[5:10])
    # y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
print(sum_mape/3)    
ls = ['svr', 'lr', 'rr', 'knn', 'gpr','dt','rf','etr',
          'gbr', 'xgb','dnn']
fig, ax = plt.subplots(1,1, figsize = (11, 8)) # create 2x2 array of subplots
# fig, ax = plt.subplots(1,4, figsize = (32, 5))
k = 1
dataset = ['d1','d2','d3','d4','d5','d6','d7','d8','d9','d10','d11','d12','d13','d14','d15' ]
for j in range(len(mb)):
    j = 2
    color = 'tab:red'
    y_r2 = find_y_r2(df_set_r2[mb[j]])
    y_mape = find_y_mape(df_set_mape[mb[j]])
    print('Mean R2 Values for dataset:', dataset_names[mb[j]],y_r2,  '\n')
    print('Median Values for dataset:', dataset_names[mb[j]],y_mape,  '\n')
    # px = ax[i,j].plot(y_r2, patch_artist = True) # add boxplot to 1st subplot
    px = ax.bar(ls,y_r2,color = 'crimson', label = 'R2')
    ax.legend(frameon=True, loc='upper left',prop={'size': 20})

    # ax[i,j].bar(ls, y,color = 'blue')
    ax.set_xticklabels(ls, rotation = 90, fontsize = 35)

    # if j == 4:
    #    ax[i,j].set_ylabel('MedAPE score')
    # ax.set_title(dataset_names[mb[j]] + ' (' + dataset[mb[j]] + ')', fontsize = 25, fontweight = 'bold') 
    ax.set_ylim(-0.5,1.5)

    ax.grid()


    ax_temp = ax.twinx()  # instantiate a second axes that shares the same x-axis
    line2 = ax_temp.plot(ls,y_mape,'--bo', color = 'blue',label='MedAPE score') # add boxplot to 1st subplot
    # line, = ax.plot([1, 2, 3], label='Inline label')
    ax_temp.legend(frameon= True, loc='upper right', prop={'size': 20})
    # ax_temp.boxplot(y_mape,labels = ls)
    # ax[i,j].bar(ls, y,color = 'blue')
    ax_temp.set_xticklabels(ls, rotation = 90)
    ax_temp.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
    # ax_temp.legend(['MedAPE score'])

    fig.tight_layout()  # otherwise the right y-label is slightly clipped
    ax_temp.set_ylim(-10,100)
    plt.rc('font', size=25)
    # plt.show()
    k = k + 1
    extent = ax.get_tightbbox(fig.canvas.get_renderer()).transformed(fig.dpi_scale_trans.inverted())
    # fig.savefig('cb_1.pdf', bbox_inches = extent)
    name = 'mb' + '_' + str(j)
    # fig.savefig(name+ '.eps', bbox_inches=extent.expanded(1.2, 1.15))
    # fig.savefig(name+ '.png', bbox_inches=extent.expanded(1.2, 1.15))
    fig.savefig(name+ '.eps')
    break
    # df.boxplot(column='price', by='bedrooms', ax=axes[0,1]) # add boxplot to 2nd subplot
    # colors = ['pink', 'lightblue', 'lightgreen', 'red', 'purple', 'yellow','green', 'blue', 'brown', 'cyan', 
    #          'crimson','crimson','crimson','crimson'] 
    # for patch, color in zip(px['boxes'], colors):
    #        patch.set_facecolor(color)
    # leg = ax.legend();
    # etc.
    # fig.legend(['R2 Score'])
    # fig.legend(['MedAPE Score'])
fig.show()
# plt.savefig('mb.pdf', bbox_inches = 'tight')
mbcb<jupyter_output><empty_output><jupyter_text>Memory and Compute Bound - Fig 8.<jupyter_code>sum_r2 = 0
for j in range(len(mbcb)):
    color = 'tab:red'
    y_r2 = find_y_r2(df_set_r2[mbcb[j]])
    print(y_r2)
    print('Mean R2 Values for dataset:', dataset_names[mbcb[j]], np.mean(y_r2[5:10]),  '\n')
    sum_r2 = sum_r2 + np.mean(y_r2[5:10])
    # y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
print(sum_r2/4)    
sum_mape = 0
for j in range(len(mbcb)):
    color = 'tab:red'
    y_mape = find_y_mape(df_set_mape[mbcb[j]])
    print('Mean R2 Values for dataset:', dataset_names[mbcb[j]], np.mean(y_mape[5:10]),  '\n')
    sum_mape = sum_mape + np.mean(y_mape[5:10])
    # y_mape = find_y_mape(df_set_mape[cb[j]])
    # print('Median Values for dataset:', dataset_names[cb[j]],y_mape,  '\n')
print(sum_mape/4)    
ls = ['svr', 'lr', 'rr', 'knn', 'gpr','dt','rf','etr',
          'gbr', 'xgb','dnn']
fig, ax = plt.subplots(1,1, figsize = (11, 8)) # create 2x2 array of subplots
# fig, ax = plt.subplots(1,4, figsize = (32, 5))
k = 0
dataset = ['d1','d2','d3','d4','d5','d6','d7','d8','d9','d10','d11','d12','d13','d14','d15' ]
for j in range(len(mbcb)):
    j = 2
    color = 'tab:red'
    y_r2 = find_y_r2(df_set_r2[mbcb[j]])
    y_mape = find_y_mape(df_set_mape[mbcb[j]])
    print('Mean R2 Values for dataset:', dataset_names[mbcb[j]],y_r2,  '\n')
    print('Median Values for dataset:', dataset_names[mbcb[j]],y_mape,  '\n')
    # px = ax[i,j].plot(y_r2, patch_artist = True) # add boxplot to 1st subplot
    px = ax.bar(ls,y_r2,color = 'mediumorchid', label = 'R2')
    ax.legend(frameon=True, loc='upper left',prop={'size': 20})

    # ax[i,j].bar(ls, y,color = 'blue')
    ax.set_xticklabels(ls, rotation = 90, fontsize = 35)

    # if j == 4:
    #    ax[i,j].set_ylabel('MedAPE score')
    # ax.set_title(dataset_names[mb[j]] + ' (' + dataset[mb[j]] + ')', fontsize = 25, fontweight = 'bold') 
    ax.set_ylim(-0.5,1.5)

    ax.grid()


    ax_temp = ax.twinx()  # instantiate a second axes that shares the same x-axis
    line2 = ax_temp.plot(ls,y_mape,'--bo', color = 'blue',label='MedAPE score') # add boxplot to 1st subplot
    # line, = ax.plot([1, 2, 3], label='Inline label')
    ax_temp.legend(frameon= True, loc='upper right', prop={'size': 20})
    # ax_temp.boxplot(y_mape,labels = ls)
    # ax[i,j].bar(ls, y,color = 'blue')
    ax_temp.set_xticklabels(ls, rotation = 90)
    ax_temp.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
    # ax_temp.legend(['MedAPE score'])

    fig.tight_layout()  # otherwise the right y-label is slightly clipped
    ax_temp.set_ylim(-10,100)
    plt.rc('font', size=25)
    # plt.show()
    k = k + 1
    extent = ax.get_tightbbox(fig.canvas.get_renderer()).transformed(fig.dpi_scale_trans.inverted())
    # fig.savefig('cb_1.pdf', bbox_inches = extent)
    name = 'mbcb' + '_' + str(j)
    # fig.savefig(name+ '.eps', bbox_inches=extent.expanded(1.2, 1.15))
    # fig.savefig(name+ '.png', bbox_inches=extent.expanded(1.2, 1.15))
    fig.savefig(name+ '.eps')
    break
    # df.boxplot(column='price', by='bedrooms', ax=axes[0,1]) # add boxplot to 2nd subplot
    # colors = ['pink', 'lightblue', 'lightgreen', 'red', 'purple', 'yellow','green', 'blue', 'brown', 'cyan', 
    #          'crimson','crimson','crimson','crimson'] 
    # for patch, color in zip(px['boxes'], colors):
    #        patch.set_facecolor(color)
    # leg = ax.legend();
    # etc.
    # fig.legend(['R2 Score'])
    # fig.legend(['MedAPE Score'])
fig.show()
# plt.savefig('mb.pdf', bbox_inches = 'tight')
def find_y_r2_last(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        # y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.mean(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
def find_y_mape_last(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.median(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
def find_y_mse_last(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        # y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.mean(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
ls = ['svr', 'lr', 'rr', 'knn', 'gpr','dt','rf','etr',
          'gbr', 'xgb']
# fig, ax = plt.subplots(3,5, figsize = (23, 15)) # create 2x2 array of subplots

k = 0
dataset = ['d1','d2','d3','d4','d5','d6','d7','d8','d9','d10','d11','d12','d13','d14','d15' ]
y_r2_all = []
y_mape_all = []
y_mse_all = []
for i in range(13):
        # color = 'tab:red'
        y_r2_all.append(find_y_r2_last(df_set_r2[i]))
        y_mape_all.append(find_y_mape_last(df_set_mape[i]))
        y_mse_all.append(find_y_mse_last(df_set_mse[i]))

ls_all_csv
cb, mb, mbcb<jupyter_output><empty_output><jupyter_text>For CB, MB and MB+CB combined<jupyter_code>def find_y_r2_last_mbcb(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y.append(np.mean(y_temp))
    # print(y)    
    return y
def find_y_mape_last_mbcb(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.median(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
def find_y_mse_last_mbcb(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        # y_temp = [x * 100 for x in y_temp]
        #print(y_temp)
        y.append(np.mean(y_temp))
        # y.append(y_temp)
    # print(y)    
    return y
ls = ['svr', 'lr', 'rr', 'knn', 'gpr','dt','rf','etr',
          'gbr', 'xgb','dnn']
# fig, ax = plt.subplots(3,5, figsize = (23, 15)) # create 2x2 array of subplots

k = 0
dataset = ['d1','d2','d3','d4','d5','d6','d7','d8','d9','d10','d11','d12','d13','d14','d15' ]
y_mape_all_cb = []
y_mape_all_mb = []
y_mape_all_mbcb = []

for i in cb:
        # color = 'tab:red'
        # y_r2_all_cb.append(find_y_r2_last_mbcb(df_set_r2[i], cb))
        y_mape_all_cb.append(find_y_mape_last_mbcb(df_set_mape[i]))
        # y_mse_all_cb.append(find_y_mse_last_mbcb(df_set_mse[i]))
for i in mb:
        # color = 'tab:red'
        # y_r2_all_cb.append(find_y_r2_last_mbcb(df_set_r2[i], cb))
        y_mape_all_mb.append(find_y_mape_last_mbcb(df_set_mape[i]))
        # y_mse_all_cb.append(find_y_mse_last_mbcb(df_set_mse[i]))
for i in mbcb:
        # color = 'tab:red'
        # y_r2_all_cb.append(find_y_r2_last_mbcb(df_set_r2[i], cb))
        y_mape_all_mbcb.append(find_y_mape_last_mbcb(df_set_mape[i]))
        # y_mse_all_cb.append(find_y_mse_last_mbcb(df_set_mse[i]))

len(y_mape_all_cb), len(y_mape_all_mb), len(y_mape_all_mbcb) 
len(y_mape_all_cb[0])
temp_mape_cb = [] 
temp_mape_mb = [] 
temp_mape_mbcb = []
for i in range(11): # num of models
    temp_sum = 0
    for j in range(6): 
        temp_sum = temp_sum + y_mape_all_cb[j][i] 
    temp_mape_cb.append(temp_sum/6) 
    
for i in range(11):
    temp_sum = 0
    for j in range(3):
        temp_sum = temp_sum + y_mape_all_mb[j][i] 
    temp_mape_mb.append(temp_sum/3) 
    
for i in range(11):
    temp_sum = 0
    for j in range(4):
        temp_sum = temp_sum + y_mape_all_mbcb[j][i] 
    temp_mape_mbcb.append(temp_sum/4) 
    
ls<jupyter_output><empty_output><jupyter_text>Fig 9 values<jupyter_code>print('\nMean MedAPE for CB', temp_mape_cb)
print('\n Its mean:', np.mean(temp_mape_cb) )
print('\nMean MedAPE for MB', temp_mape_mb)
print('\n Its mean:', np.mean(temp_mape_mb) )
print('\nMean MedAPE for MBCB', temp_mape_mbcb)
print('\n Its mean:', np.mean(temp_mape_mbcb) )
fig, ax = plt.subplots(1,3, figsize = (27,8))
ax[0].bar(ls, temp_mape_cb, color = 'springgreen')
# ax[0].set_xlabel('Models')
# ax[0].set_ylabel('Mean MedAPE', fontweight = 'bold')
ax[0].set_title('Compute Bound Applications', fontsize = 26, fontweight = 'bold')
ax[0].set_xticklabels(ls, rotation = 90, fontsize = 35)
ax[0].set_ylim(0,30)
ax[0].ticklabel_format(style='sci', axis='y', scilimits=(0,0))
ax[0].grid()
ax[1].bar(ls, temp_mape_mb, color = 'crimson')
# 3ax[1].set_xlabel('Models')
# ax[1].set_ylabel('Mean MedAPE', fontweight = 'bold')
ax[1].set_title('Memory Bound Applications', fontweight = 'bold',fontsize = 26)
ax[1].set_xticklabels(ls, rotation = 90, fontsize = 35, fontweight = 'bold')
ax[1].set_ylim(0,30)
ax[1].ticklabel_format(style='sci', axis='y', scilimits=(0,0))
ax[1].grid()

ax[2].bar(ls, temp_mape_mbcb, color = 'mediumorchid')
# ax[0].set_xlabel('Models')
# ax[0].set_ylabel('Mean MedAPE', fontweight = 'bold')
ax[2].set_title('Both Bound Applications', fontsize = 26, fontweight = 'bold')
ax[2].set_xticklabels(ls, rotation = 90, fontsize = 35)
ax[2].set_ylim(0,30)
ax[2].ticklabel_format(style='sci', axis='y', scilimits=(0,0))
ax[2].grid()


plt.rc('font', size=30)
fig.tight_layout()  # otherwise the right y-label is slightly clipped
fig.show()
plt.savefig('overall_result_mbcb_all.pdf', bbox_inches = 'tight')

len(y_mape_all), len(y_r2_all), len(y_mse_all) # Find average value of each model over all datasets
y_mape_all[0] # -> Dataset1
temp_r2 = []
temp_mape = [] 
temp_mse = []
for i in range(11):
    temp_sum = 0
    for j in range(13):
        temp_sum = temp_sum + y_r2_all[j][i] 
    temp_r2.append(temp_sum/13) 
for i in range(11):
    temp_sum = 0
    for j in range(13):
        temp_sum = temp_sum + y_mape_all[j][i] 
    temp_mape.append(temp_sum/13)     
for i in range(11):
    temp_sum = 0
    for j in range(13):
        temp_sum = temp_sum + y_mse_all[j][i] 
    temp_mse.append(temp_sum/13)<jupyter_output><empty_output><jupyter_text>Fig. 6 values<jupyter_code>print('\n Mean R2 values:', temp_r2)
sort_index_r2 = np.argsort(temp_r2)
# print('\n Index of R2 is',  sort_index_r2) 
# for i in range(14):
#     print(ls[sort_index_r2[i]])

print('\n Mean MedAPE values:', temp_mape)
sort_index_mape = np.argsort(temp_mape)
# print('\n Index of MedAPE is',  sort_index_mape) 
# for i in range(14):
#    print(ls[sort_index_mape[i]])

print('\n Mean MSE values:', temp_mse)
sort_index_mse = np.argsort(temp_mse)
# print('\n Index of MSE is',  sort_index_mse) 
# for i in range(14):
#     print(ls[sort_index_mse[i]])
temp = [4,6,1]
# sort_index = np.argsort(temp)
# print('\n Index of temp is',  sort_index) 

# Ascending sort 
print(ls)
print(sort_index_r2)
print(sort_index_mape)
print(sort_index_mse)
ls<jupyter_output><empty_output><jupyter_text>Fig. 5<jupyter_code>fig, ax = plt.subplots(1,3, figsize = (25,7))
ax[0].bar(ls, temp_r2,color = 'dodgerblue')
# ax[0].set_xlabel('Models')
ax[0].set_ylabel('Mean R2 score', fontsize = 30, fontweight = 'bold')
# ax[0].set_title('Comparison of performance')
ax[0].set_xticklabels(ls, rotation = 90, fontsize = 30)
ax[0].set_ylim(-0.5,1.5)
ax[0].grid()
ax[1].bar(ls, temp_mape, color = 'lightcoral')
# ax[1].set_xlabel('Models')
ax[1].set_ylabel('Mean MedAPE', fontsize = 30, fontweight = 'bold')
# ax[1].set_title('Comparison of performance')
ax[1].set_xticklabels(ls, rotation = 90, fontsize = 30)
ax[1].set_ylim(0,25)
ax[1].ticklabel_format(style='sci', axis='y', scilimits=(0,0))
ax[1].grid()
# fig.tight_layout()  # otherwise the right y-label is slightly clipped
ax[2].bar(ls, temp_mse, color = 'darkorchid')
# ax[2].set_xlabel('Models')
ax[2].set_ylabel('Mean MSE', fontsize = 30, fontweight = 'bold')
# ax[2].set_title('Comparison of performance')
ax[2].set_xticklabels(ls, rotation = 90, fontsize = 30, fontweight = 'bold')
# ax[2].set_ylim(-100,2e12)
ax[2].ticklabel_format(style='sci', axis='y', scilimits=(0,0))
ax[2].grid()
plt.rc('font', size =30)
fig.tight_layout()  # otherwise the right y-label is slightly clipped
fig.show()
plt.savefig('overall_result.pdf', bbox_inches = 'tight')
# 15 plots -> 2 X 5 grid of axes - > Just R2 scores and medAPE
def plot_boxplot_axes(df, file, val):
    ls = ['best_svr', 'best_lr', 'best_rr', 'best_knn', 'best_gpr','best_dt','best_rf','best_etr',
          'best_gbr', 'best_xgb']
    new_df = pd.DataFrame(columns = ls) 
    for i in range(len(ls)):
        arr = [float(s) for s in df[val][i][1:-1].split(',')]
        new_df[ls[i]] = arr
    return new_df
df_set = [] 
for file in ls_all_csv:
    df = pd.read_csv(all_csv_path + '/' + file)
    df_set.append(plot_boxplot_axes(df, file, val = 'r2'))
df_set[0].head()
def find_y(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y.append(y_temp)
    # print(y)    
    return y
ls_all_csv
y1 = find_y(df_set[11])  # Physical SVM - CB
y2 = find_y(df_set[12])  # Simulated SVM - CB
y3 = find_y(df_set[0])  # Physical Dijsktra - MB
y4 = find_y(df_set[1])  # Simulated Dijkstra - MB
y5 = find_y(df_set[2])  # Physical - Qsort - MBCB
y6 = find_y(df_set[3])  # Simulated - Qsort - MBCB
len(y1)
len(y1), len(y1[0])

t_R2_1 = y1[5:10]
s_R2_1 = []
for i in range(5):
    s_R2_1.append(np.mean(t_R2_1[i])) 
    #print(np.mean(t_R2_1[i]))
print('SVM Physical:CB\n')    
print(np.mean(s_R2_1))    

t_R2_2 = y2[5:10]
s_R2_2 = []
for i in range(5):
    s_R2_2.append(np.mean(t_R2_2[i])) 
    #print(np.mean(t_R2_2[i]))
print('SVM simlulated:CB\n')    
print(np.mean(s_R2_2))    

t_R2_3 = y3[5:10]
s_R2_3 = []
for i in range(5):
    s_R2_3.append(np.mean(t_R2_3[i])) 
    #print(np.mean(t_R2_3[i]))
print('Dijkstra Physical:MB\n')    
print(np.mean(s_R2_3))    

t_R2_4 = y4[5:10]
s_R2_4 = []
for i in range(5):
    s_R2_4.append(np.mean(t_R2_4[i])) 
print('Dijkstra Simulated:MB\n')
#print(np.mean(t_R2_4[i]))
print(np.mean(s_R2_4))    

t_R2_5 = y5[5:10]
s_R2_5 = []
for i in range(5):
    s_R2_5.append(np.mean(t_R2_5[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Physical:MBCB\n')    
print(np.mean(s_R2_5))    

t_R2_6 = y6[5:10]
s_R2_6 = []
for i in range(5):
    s_R2_6.append(np.mean(t_R2_6[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Simulated:MBCB\n')
    
print(np.mean(s_R2_6))    



t_R2_1 = y1
s_R2_1 = []
for i in range(10):
    s_R2_1.append(np.mean(t_R2_1[i])) 
    #print(np.mean(t_R2_1[i]))
print('SVM Physical:CB\n')    
print(np.mean(s_R2_1))    

t_R2_2 = y2
s_R2_2 = []
for i in range(10):
    s_R2_2.append(np.mean(t_R2_2[i])) 
    #print(np.mean(t_R2_2[i]))
print('SVM simlulated:CB\n')    
print(np.mean(s_R2_2))    

t_R2_3 = y3
s_R2_3 = []
for i in range(10):
    s_R2_3.append(np.mean(t_R2_3[i])) 
    #print(np.mean(t_R2_3[i]))
print('Dijkstra Physical:MB\n')    
print(np.mean(s_R2_3))    

t_R2_4 = y4
s_R2_4 = []
for i in range(10):
    s_R2_4.append(np.mean(t_R2_4[i])) 
print('Dijkstra Simulated:MB\n')
#print(np.mean(t_R2_4[i]))
print(np.mean(s_R2_4))    

t_R2_5 = y5
s_R2_5 = []
for i in range(10):
    s_R2_5.append(np.mean(t_R2_5[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Physical:MBCB\n')    
print(np.mean(s_R2_5))    

t_R2_6 = y6
s_R2_6 = []
for i in range(10):
    s_R2_6.append(np.mean(t_R2_6[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Simulated:MBCB\n')
    
print(np.mean(s_R2_6))    


# physical -> Simulated
np.mean([s_R2_1, s_R2_3, s_R2_5]), np.mean([s_R2_2, s_R2_4, s_R2_6]) 
s_R2_1
np.mean(y4[5:10]) 
(0.9822929973312803 + 0.9957837425145488)/2<jupyter_output><empty_output><jupyter_text>Fig 5 left values<jupyter_code>print('\n R2 Values for SVM Physical: ', y1)
print('\n R2Values for SVM Simulated: ', y2)
print('\n R2 Values for Dijkstra Physical: ', y3)
print('\n R2 Values for Dijkstra Simulated: ', y4)
print('\n R2 Values for Qsort Physical: ', y5)
print('\n R2 Values for Qsort Simulated: ', y6)
fig, ax = plt.subplots(3,2,figsize = (16,9))
box1 = ax[0][0].boxplot(y1, labels = None, patch_artist = True)
ax[0][0].set_xticklabels([])
colors1 = ['darkgreen', 'darkgreen','darkgreen', 'darkgreen','darkgreen', 'darkgreen','darkgreen', 'darkgreen',
           'darkgreen', 'darkgreen']
colors2 = ['indigo', 'indigo','indigo', 'indigo','indigo', 'indigo','indigo', 'indigo','indigo', 'indigo']
for patch, color in zip(box1['boxes'], colors1):
    patch.set_facecolor(color)
# ax[0][0].set_ylabel('R2 score')
ax[0][0].set_title('SVM- Physical', fontsize = 15, fontweight = 'bold')
ax[0][0].set_ylim(-1,1.5)
# ax[0][0].set_xticklabels(ls, rotation = 25)
ax[0][0].grid()

box2 = ax[0][1].boxplot(y2,patch_artist = True)
ax[0][1].set_xticklabels([])
# ax[0][1].set_xticklabels(ls, rotation = 90, fontsize = 15)
for patch, color in zip(box2['boxes'], colors2):
    patch.set_facecolor(color)
# ax[0][1].set_xlabel('Matrix Mutiplication - Simulated')
# ax[0][1].set_ylabel('R2 score')
ax[0][1].set_title('SVM- Simulated', fontsize = 15, fontweight = 'bold')
ax[0][1].set_ylim(-1,1.5)
# ax[0][1].set_xticklabels(ls, rotation = 35)
ax[0][1].grid()

box3 = ax[1][0].boxplot(y3,patch_artist = True)
ax[1][0].set_xticklabels([])
for patch, color in zip(box3['boxes'], colors1):
    patch.set_facecolor(color)
# ax[1][0].set_xlabel('Montecarlocalcpi - Physical')
# ax[1][0].set_ylabel('R2 score')
ax[1][0].set_title('Dijkstra - Physical', fontsize = 15, fontweight = 'bold')
ax[1][0].set_ylim(-1,1.5)
# ax[1][0].set_xticklabels(ls, rotation = 90, fontsize = 15)

# ax[1][0].set_xticklabels(ls, rotation = 25)
ax[1][0].grid()
box4 = ax[1][1].boxplot(y4,patch_artist = True)
ax[1][1].set_xticklabels([])
for patch, color in zip(box4['boxes'], colors2):
    patch.set_facecolor(color)
# ax[1][1].set_xlabel('Montecarlocalcpi - Simulated')
# ax[1][1].set_ylabel('R2 score')
ax[1][1].set_title('Dijkstra - Simulated', fontsize = 15, fontweight = 'bold')
ax[1][1].set_ylim(-1,1.5)
# ax[1][1].set_xticklabels(ls, rotation = 90, fontsize = 15)
ax[1][1].grid()

box5 = ax[2][0].boxplot(y5,patch_artist = True)
ax[2][0].set_xticklabels([])
for patch, color in zip(box5['boxes'], colors1):
    patch.set_facecolor(color)
# ax[1][1].set_xlabel('Montecarlocalcpi - Simulated')
# ax[1][1].set_ylabel('R2 score')
ax[2][0].set_title('Qsort - Physical', fontsize = 15, fontweight = 'bold')
ax[2][0].set_ylim(-1,1.5)
ax[2][0].set_xticklabels(ls, rotation = 90, fontsize = 15)
ax[2][0].grid()

box6 = ax[2][1].boxplot(y6, patch_artist = True)
ax[2][1].set_xticklabels([])
for patch, color in zip(box6['boxes'], colors2):
    patch.set_facecolor(color)
# ax[1][1].set_xlabel('Montecarlocalcpi - Simulated')
# ax[1][1].set_ylabel('R2 score')
ax[2][1].set_title('Qsort - Simulated', fontsize = 15, fontweight = 'bold')
ax[2][1].set_ylim(-1,1.5)
ax[2][1].set_xticklabels(ls, rotation = 90, fontsize = 15)
ax[2][1].grid()


plt.rc('font', size=12)
# fig.text(0.08, 0.44, 'R2 Score', ha='center', rotation = 'vertical', fontsize = 20)
plt.savefig('physical_vs_simulated_r2.pdf', bbox_inches = 'tight')

# colors = ['pink', 'lightblue', 'lightgreen', 'red', 'purple', 'yellow','green', 'blue', 'brown', 'cyan', 
#          'crimson','crimson','crimson','crimson'] 
# for patch, color in zip(px['boxes'], colors):
#        patch.set_facecolor(color)<jupyter_output><empty_output><jupyter_text>ALL R2  = APE from now onwards<jupyter_code># Finding overall mean R2 score in physical vs simulated
# y1, y3 and y5 -> physical
# y2, y4 and y6 -> Simulated
mean_r2_physical_1 = []
mean_r2_physical_2 = []
mean_r2_physical_3 = []
mean_r2_simulated_1 = []
mean_r2_simulated_2 = []
mean_r2_simulated_3 = []

for i in range(10):
    mean_r2_physical_1.append(np.mean(y1[i]))
for i in range(10):
    mean_r2_physical_2.append(np.mean(y3[i]))
for i in range(10):
    mean_r2_physical_3.append(np.mean(y5[i]))
    
        
for i in range(10):
    mean_r2_simulated_1.append(np.mean(y2[i]))
for i in range(10):
    mean_r2_simulated_2.append(np.mean(y4[i]))
for i in range(10):
    mean_r2_simulated_3.append(np.mean(y6[i]))
    
p1 = np.mean(mean_r2_physical_1)
p2 = np.mean(mean_r2_physical_2)
p3 = np.mean(mean_r2_physical_3)
print('\nMean R2 for Physcial_1:',p1)
print('\nMean R2 for Physcial_2:',p2)
print('\nMean R2 for Physcial_3:',p3)
p = [p1,p2,p3]

print('\n ******** Overall R2 Physical :', np.mean(p))

s1 = np.mean(mean_r2_simulated_1)
s2 = np.mean(mean_r2_simulated_2)
s3 = np.mean(mean_r2_simulated_3)
print('\nMean R2 for Simulated_1:', s1)
print('\nMean R2 for Simulated_2:', s2)
print('\nMean R2 for Simulated_3:', s3)
s = [s1,s2,s3]

print('\n ******* Overall R2 Simulated :', np.mean(s))

df_set = [] 
for file in ls_all_csv:
    df = pd.read_csv(all_csv_path + '/' + file)
    df_set.append(plot_boxplot_axes(df, file, val = 'mape'))
def find_y_mape(df):
    y = []
    for i in range(len(df.columns)):
        y_temp = df[df.columns[i]].tolist()
        y_temp = [x * 100 for x in y_temp]
        y.append(y_temp)
    # print(y)    
    return y
ls_all_csv
y1 = find_y(df_set[11])  # Physical SVM - CB
y2 = find_y(df_set[12])  # Simulated SVM - CB
y3 = find_y(df_set[0])  # Physical Dijsktra - MB
y4 = find_y(df_set[1])  # Simulated Dijkstra - MB
y5 = find_y(df_set[2])  # Physical - Qsort - MBCB
y6 = find_y(df_set[3])  # Simulated - Qsort - MBCB

t_R2_1 = y1[5:10]
s_R2_1 = []
for i in range(5):
    s_R2_1.append(np.mean(t_R2_1[i])) 
    #print(np.mean(t_R2_1[i]))
print('SVM Physical:CB\n')    
print(np.mean(s_R2_1))    

t_R2_2 = y2[5:10]
s_R2_2 = []
for i in range(5):
    s_R2_2.append(np.mean(t_R2_2[i])) 
    #print(np.mean(t_R2_2[i]))
print('SVM simlulated:CB\n')    
print(np.mean(s_R2_2))    

t_R2_3 = y3[5:10]
s_R2_3 = []
for i in range(5):
    s_R2_3.append(np.mean(t_R2_3[i])) 
    #print(np.mean(t_R2_3[i]))
print('Dijkstra Physical:MB\n')    
print(np.mean(s_R2_3))    

t_R2_4 = y4[5:10]
s_R2_4 = []
for i in range(5):
    s_R2_4.append(np.mean(t_R2_4[i])) 
print('Dijkstra Simulated:MB\n')
#print(np.mean(t_R2_4[i]))
print(np.mean(s_R2_4))    

t_R2_5 = y5[5:10]
s_R2_5 = []
for i in range(5):
    s_R2_5.append(np.mean(t_R2_5[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Physical:MBCB\n')    
print(np.mean(s_R2_5))    

t_R2_6 = y6[5:10]
s_R2_6 = []
for i in range(5):
    s_R2_6.append(np.mean(t_R2_6[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Simulated:MBCB\n')
    
print(np.mean(s_R2_6))    



t_R2_1 = y1
s_R2_1 = []
for i in range(10):
    s_R2_1.append(np.mean(t_R2_1[i])) 
    #print(np.mean(t_R2_1[i]))
print('SVM Physical:CB\n')    
print(np.mean(s_R2_1))    

t_R2_2 = y2
s_R2_2 = []
for i in range(10):
    s_R2_2.append(np.mean(t_R2_2[i])) 
    #print(np.mean(t_R2_2[i]))
print('SVM simlulated:CB\n')    
print(np.mean(s_R2_2))    

t_R2_3 = y3
s_R2_3 = []
for i in range(10):
    s_R2_3.append(np.mean(t_R2_3[i])) 
    #print(np.mean(t_R2_3[i]))
print('Dijkstra Physical:MB\n')    
print(np.mean(s_R2_3))    

t_R2_4 = y4
s_R2_4 = []
for i in range(10):
    s_R2_4.append(np.mean(t_R2_4[i])) 
print('Dijkstra Simulated:MB\n')
#print(np.mean(t_R2_4[i]))
print(np.mean(s_R2_4))    

t_R2_5 = y5
s_R2_5 = []
for i in range(10):
    s_R2_5.append(np.mean(t_R2_5[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Physical:MBCB\n')    
print(np.mean(s_R2_5))    

t_R2_6 = y6
s_R2_6 = []
for i in range(10):
    s_R2_6.append(np.mean(t_R2_6[i])) 
    #print(np.mean(t_R2_4[i]))
print('Qsort Simulated:MBCB\n')
    
print(np.mean(s_R2_6))    


# physical -> Simulated
np.mean([s_R2_1, s_R2_3, s_R2_5]), np.mean([s_R2_2, s_R2_4, s_R2_6]) 
(6.70931309689159 + 1.6991812183662407)/2
# Finding overall mean R2 score in physical vs simulated
# y1, y3 and y5 -> physical
# y2, y4 and y6 -> Simulated
mean_r2_physical_1 = []
mean_r2_physical_2 = []
mean_r2_physical_3 = []
mean_r2_simulated_1 = []
mean_r2_simulated_2 = []
mean_r2_simulated_3 = []

for i in range(10):
    mean_r2_physical_1.append(np.mean(y1[i]))
for i in range(10):
    mean_r2_physical_2.append(np.mean(y3[i]))
for i in range(10):
    mean_r2_physical_3.append(np.mean(y5[i]))
    
        
for i in range(10):
    mean_r2_simulated_1.append(np.mean(y2[i]))
for i in range(10):
    mean_r2_simulated_2.append(np.mean(y4[i]))
for i in range(10):
    mean_r2_simulated_3.append(np.mean(y6[i]))
    
p1 = np.mean(mean_r2_physical_1)
p2 = np.mean(mean_r2_physical_2)
p3 = np.mean(mean_r2_physical_3)
print('\nMean APE for Physcial_1:',p1)
print('\nMean R2 for Physcial_2:',p2)
print('\nMean R2 for Physcial_3:',p3)
p = [p1,p2,p3]

print('\n ******** Overall R2 Physical :', np.mean(p))

s1 = np.mean(mean_r2_simulated_1)
s2 = np.mean(mean_r2_simulated_2)
s3 = np.mean(mean_r2_simulated_3)
print('\nMean R2 for Simulated_1:', s1)
print('\nMean R2 for Simulated_2:', s2)
print('\nMean R2 for Simulated_3:', s3)
s = [s1,s2,s3]

print('\n ******* Overall R2 Simulated :', np.mean(s))

# Fig. 5 right values
print('\n R2 Values for SVM Physical: ', y1)
print('\n R2Values for SVM Simulated: ', y2)
print('\n R2 Values for Dijkstra Physical: ', y3)
print('\n R2 Values for Dijkstra Simulated: ', y4)
print('\n R2 Values for Qsort Physical: ', y5)
print('\n R2 Values for Qsort Simulated: ', y6)
for i in range(10):
    y1[i] = [x*100 for x in y1[i]]
for i in range(10):
    y2[i] = [x*100 for x in y2[i]]
for i in range(10):
    y3[i] = [x*100 for x in y3[i]]
for i in range(10):
    y4[i] = [x*100 for x in y4[i]]
for i in range(10):
    y5[i] = [x*100 for x in y5[i]]
for i in range(10):
    y6[i] = [x*100 for x in y6[i]]

fig, ax = plt.subplots(3,2,figsize = (16,9))
box1 = ax[0][0].boxplot(y1, labels = None, patch_artist = True)
ax[0][0].set_xticklabels([])
colors1 = ['darkgreen', 'darkgreen','darkgreen', 'darkgreen','darkgreen', 'darkgreen','darkgreen', 'darkgreen',
           'darkgreen', 'darkgreen']
colors2 = ['indigo', 'indigo','indigo', 'indigo','indigo', 'indigo','indigo', 'indigo','indigo', 'indigo']
for patch, color in zip(box1['boxes'], colors1):
    patch.set_facecolor(color)
# ax[0][0].set_ylabel('R2 score')
ax[0][0].set_title('SVM- Physical', fontsize = 15, fontweight = 'bold')
ax[0][0].set_ylim(-10,40)
# ax[0][0].set_xticklabels(ls, rotation = 25)
ax[0][0].grid()

box2 = ax[0][1].boxplot(y2,patch_artist = True)
ax[0][1].set_xticklabels([])
# ax[0][1].set_xticklabels(ls, rotation = 90, fontsize = 15)
for patch, color in zip(box2['boxes'], colors2):
    patch.set_facecolor(color)
# ax[0][1].set_xlabel('Matrix Mutiplication - Simulated')
# ax[0][1].set_ylabel('R2 score')
ax[0][1].set_title('SVM- Simulated', fontsize = 15, fontweight = 'bold')
ax[0][1].set_ylim(-10,40)
# ax[0][1].set_xticklabels(ls, rotation = 35)
ax[0][1].grid()

box3 = ax[1][0].boxplot(y3,patch_artist = True)
ax[1][0].set_xticklabels([])
for patch, color in zip(box3['boxes'], colors1):
    patch.set_facecolor(color)
# ax[1][0].set_xlabel('Montecarlocalcpi - Physical')
# ax[1][0].set_ylabel('R2 score')
ax[1][0].set_title('Dijkstra - Physical', fontsize = 15, fontweight = 'bold')
ax[1][0].set_ylim(-10,40)
# ax[1][0].set_xticklabels(ls, rotation = 90, fontsize = 15)

# ax[1][0].set_xticklabels(ls, rotation = 25)
ax[1][0].grid()
box4 = ax[1][1].boxplot(y4,patch_artist = True)
ax[1][1].set_xticklabels([])
for patch, color in zip(box4['boxes'], colors2):
    patch.set_facecolor(color)
# ax[1][1].set_xlabel('Montecarlocalcpi - Simulated')
# ax[1][1].set_ylabel('R2 score')
ax[1][1].set_title('Dijkstra - Simulated', fontsize = 15, fontweight = 'bold')
ax[1][1].set_ylim(-10,40)
# ax[1][1].set_xticklabels(ls, rotation = 90, fontsize = 15)
ax[1][1].grid()

box5 = ax[2][0].boxplot(y5,patch_artist = True)
ax[2][0].set_xticklabels([])
for patch, color in zip(box5['boxes'], colors1):
    patch.set_facecolor(color)
# ax[1][1].set_xlabel('Montecarlocalcpi - Simulated')
# ax[1][1].set_ylabel('R2 score')
ax[2][0].set_title('Qsort - Physical', fontsize = 15, fontweight = 'bold')
ax[2][0].set_ylim(-10,40)
ax[2][0].set_xticklabels(ls, rotation = 90, fontsize = 15)
ax[2][0].grid()

box6 = ax[2][1].boxplot(y6, patch_artist = True)
ax[2][1].set_xticklabels([])
for patch, color in zip(box6['boxes'], colors2):
    patch.set_facecolor(color)
# ax[1][1].set_xlabel('Montecarlocalcpi - Simulated')
# ax[1][1].set_ylabel('R2 score')
ax[2][1].set_title('Qsort - Simulated', fontsize = 15, fontweight = 'bold')
ax[2][1].set_ylim(-10,40)
ax[2][1].set_xticklabels(ls, rotation = 90, fontsize = 15)
ax[2][1].grid()


plt.rc('font', size=12)
# fig.text(0.08, 0.44, 'R2 Score', ha='center', rotation = 'vertical', fontsize = 20)
plt.savefig('physical_vs_simulated_mape.pdf', bbox_inches = 'tight')

# colors = ['pink', 'lightblue', 'lightgreen', 'red', 'purple', 'yellow','green', 'blue', 'brown', 'cyan', 
#          'crimson','crimson','crimson','crimson'] 
# for patch, color in zip(px['boxes'], colors):
#        patch.set_facecolor(color)<jupyter_output>findfont: Font family ['normal'] not found. Falling back to DejaVu Sans.
StarcoderdataJupyterStructuredCleanDedup