1
0
Fork 0
QuaPy/laboratory/show_results.py

42 lines
838 B
Python
Raw Normal View History

2023-07-20 09:03:22 +02:00
import sys
from pathlib import Path
import pandas as pd
2023-07-24 16:28:21 +02:00
result_dir = 'results_tweet_1000'
#result_dir = 'results_lequa'
2023-07-20 09:03:22 +02:00
dfs = []
pathlist = Path(result_dir).rglob('*.csv')
for path in pathlist:
path_in_str = str(path)
2023-07-21 11:41:16 +02:00
try:
df = pd.read_csv(path_in_str, sep='\t')
2023-07-24 16:28:21 +02:00
df = df[df.iloc[:, 0] != df.columns[0]]
2023-07-21 11:41:16 +02:00
if not df.empty:
dfs.append(df)
except Exception:
print('empty')
2023-07-20 09:03:22 +02:00
df = pd.concat(dfs)
2023-07-24 16:28:21 +02:00
for err in ['MAE', 'MRAE', 'KLD']:
2023-07-21 11:41:16 +02:00
print('-'*100)
print(err)
print('-'*100)
piv = df.pivot_table(index='Dataset', columns='Method', values=err)
piv.loc['mean'] = piv.mean()
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
pd.set_option('expand_frame_repr', False)
print(piv)
print()
2023-07-20 09:03:22 +02:00