import pickle import os import sys import pandas as pd import quapy as qp from quapy.model_selection import GridSearchQ from quapy.protocol import UPP from commons import METHODS, new_method, show_results from new_table import LatexTable SEED = 1 if __name__ == '__main__': print(qp.datasets.UCI_MULTICLASS_DATASETS) table = LatexTable() for optim in ['mae']: result_dir = f'results/ucimulti/{optim}' for method in METHODS: print() global_result_path = f'{result_dir}/{method}' print(f'Method\tDataset\tMAE\tMRAE\tKLD') for dataset in qp.datasets.UCI_MULTICLASS_DATASETS: # print(dataset) local_result_path = global_result_path + '_' + dataset if os.path.exists(local_result_path + '.dataframe'): report = pd.read_csv(local_result_path+'.dataframe') print(f'{method}\t{dataset}\t{report["mae"].mean():.5f}') table.add(benchmark=dataset, method=method, v=report["mae"].values) else: print(dataset, 'not found') table.latexPDF(f'./tables/{optim}.pdf', landscape=False)