def print_results(out_file):
names, results = test()
table_data = [[name] + result for name, result in zip(names, results)]
table = tabulate.tabulate(table_data, headers=['dataset', 'acc', 'prec', 'rec', 'f1'], tablefmt='simple', floatfmt='.3f')
if out_file:
with open(out_file, 'a') as f:
f.write('\n')
f.write('+++Bag-of-words+++\n')
f.write(table)
f.write('\n')
else:
print()
print('+++Bag-of-words with L2 regularized Logistic Regression+++')
print(table)
评论列表
文章目录