我有一个文本文件,用于存储使用pandas
,v_confusion = pd.crosstab(y_actu, y_pred)
创建的混淆矩阵,然后使用pickle
将其存储在文本文件中,
with open(filename_validation_confusion, 'wb') as c:
pickle.dump('Iteration ' + str(i), c)
pickle.dump(v_confusion, c)
pickle.dump('\n', c)
何时加载文本文件
with open(f_name, 'rb') as cm:
while True:
line = pickle.load(cm)
print(line)
我得到以下输出:
Iteration 670
Predicted 1 2 3 4 6 7 8 9 11 12 ... 33 34 36 37 38 40 41 42 43 44
Actual ...
0 0 0 0 0 0 0 0 0 0 4307 ... 0 0 0 0 0 0 0 1 0 0
1 128 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
2 0 258 1 0 0 2 0 0 0 11 ... 0 0 0 0 0 0 0 0 0 1
3 0 0 475 0 4 1 0 0 0 1 ... 1 2 0 0 0 0 0 0 0 0
4 0 0 0 1 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 1 0 0 0 2 ... 0 0 0 0 0 0 0 0 0 0
6 1 0 0 0 510 6 0 0 0 34 ... 2 0 0 0 0 0 0 0 0 0
问题是隐藏了一些输出。我想看到一切。