Spaces:
Running
Running
File size: 1,166 Bytes
86a83a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
from __future__ import print_function
import sys
import glob
import numpy as np
DATASET = 'SS-Twitter' # 'SE1604' excluded due to Twitter's ToS
METHOD = 'new'
# Optional usage: analyze_results.py <dataset> <method>
if len(sys.argv) == 3:
DATASET = sys.argv[1]
METHOD = sys.argv[2]
RESULTS_DIR = 'results/'
RESULT_PATHS = glob.glob('{}/{}_{}_*_results.txt'.format(RESULTS_DIR, DATASET, METHOD))
if not RESULT_PATHS:
print('Could not find results for \'{}\' using \'{}\' in directory \'{}\'.'.format(DATASET, METHOD, RESULTS_DIR))
else:
scores = []
for path in RESULT_PATHS:
with open(path) as f:
score = f.readline().split(':')[1]
scores.append(float(score))
average = np.mean(scores)
maximum = max(scores)
minimum = min(scores)
std = np.std(scores)
print('Dataset: {}'.format(DATASET))
print('Method: {}'.format(METHOD))
print('Number of results: {}'.format(len(scores)))
print('--------------------------')
print('Average: {}'.format(average))
print('Maximum: {}'.format(maximum))
print('Minimum: {}'.format(minimum))
print('Standard deviaton: {}'.format(std))
|