else: top_perfs_all = np.append(top_perfs_all, [top_perfs], axis=0) recalls_all = np.append(recalls_all, [recalls], axis=0) mapes_all = np.append(mapes_all, [mapes], axis=0) print("For different percentages of replaced samples:") colns = list( map(str, np.arange(pct_repl_start, pct_repl_end, pct_repl_step).round(4))) print(f"Top performance ({perfn}):") top_perfs_avg = np.mean(top_perfs_all, axis=0) df_top_perf = pd.DataFrame([top_perfs_avg], columns=colns) df_top_perf = df_top_perf.round(4) print(df_top_perf) sp.df2csv(df_top_perf, dir_name + algo + '_top_perf_' + str(num_smpl) + '.csv') print("Recall score:") recalls_avg = np.mean(recalls_all, axis=0) df_recall = pd.DataFrame(np.c_[df_recall[['pct_top', 'num_top']].values, \ np.transpose(recalls_avg)], columns=['pct_top', 'num_top']+colns) df_recall = df_recall.round(4) print(df_recall) sp.df2csv(df_recall, dir_name + algo + '_recall_' + str(num_smpl) + '.csv') print("MAPE:") mapes_avg = np.mean(mapes_all, axis=0) df_mape = pd.DataFrame(np.c_[df_mape['pct_top'].values, \ np.transpose(mapes_avg)], columns=['pct_top']+colns) df_mape = df_mape.round(4) print(df_mape)
elif (wf == 'ht'): df_perf = sp.df_ht[['exec_time', 'comp_time']] elif (wf == 'sw'): df_perf = sp.df_sw[['exec_time', 'comp_time']] elif (wf == 'hs'): df_perf = sp.df_hs[['exec_time', 'comp_time']] elif (wf == 'gs'): df_perf = sp.df_gs[['exec_time', 'comp_time']] elif (wf == 'pdf'): df_perf = sp.df_pdf[['exec_time', 'comp_time']] elif (wf == 'gvpv'): df_perf = sp.df_gvpv[['exec_time', 'comp_time']] else: print("Error: unknown workflow!") exit() sp.df2csv(df_perf[perfn], dir_name + wf + '_' + perfn + '.csv') ''' exec_upper = 20 * min(df_perf['exec_time'].values) comp_upper = 20 * min(df_perf['comp_time'].values) if (perfn == 'exec_time'): sp.df2csv(df_perf[df_perf.exec_time <= exec_upper][perfn], \ dir_name + wf + '_' + perfn + '.csv') elif (perfn == 'comp_time'): sp.df2csv(df_perf[df_perf.comp_time <= comp_upper][perfn], \ dir_name + wf + '_' + perfn + '.csv') else: print("Error: unknown performance metrics!") exit() '''
alich_mape = np.append(alich_mape, [df_mape.values], axis=0) alich_comp_time = np.append(alich_comp_time, [comp_time], axis=0) ''' colns = ['RS', 'AL', 'CEAL', 'CEALH', 'ALpH'] #, 'GEIST'] print(f"Top performance ({perfn}):") top_perf = np.c_[np.mean(rs_top_perf, axis=0), \ np.mean(al_top_perf, axis=0), \ np.mean(ceal_top_perf, axis=0), \ np.mean(cealh_top_perf, axis=0), \ np.mean(alph_top_perf, axis=0) \ # np.mean(geist_top_perf, axis=0) \ ] df_top_perf = pd.DataFrame(top_perf, columns=colns).round(4) print(df_top_perf) sp.df2csv(df_top_perf, dir_name + 'top_perf_' + str(num_smpl) + '.csv') print("MAPE (%):") mape_avg = np.c_[np.mean(rs_mape, axis=0), \ np.mean(al_mape, axis=0)[:, -1], \ np.mean(ceal_mape, axis=0)[:, -1], \ np.mean(cealh_mape, axis=0)[:, -1], \ np.mean(alph_mape, axis=0)[:, -1] \ # np.mean(geist_mape, axis=0)[:, -1] \ ] df_mapes = pd.DataFrame(mape_avg, columns=['pct_top'] + colns).round(4) print(df_mapes) sp.df2csv(df_mapes, dir_name + 'mape_' + str(num_smpl) + '.csv') print("Recall Score (%):") recall_avg = np.c_[np.mean(rs_recall, axis=0), \
def gen_unmeas_smpl(filens_smpl, filens_meas, filen_unmeas, paramns): df_smpl = sp.csv2df(glob.glob(filens_smpl), paramns) df_meas_perf = sp.csv2df(glob.glob(filens_meas), paramns) df_meas = mdlr.df_intersection(df_smpl, df_meas_perf, paramns) df_unmeas = pd.concat([df_smpl, df_meas]).drop_duplicates(keep=False).astype(int) sp.df2csv(df_unmeas, filen_unmeas)