-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxiu1_testset_stats_analysis.py
58 lines (44 loc) · 1.11 KB
/
xiu1_testset_stats_analysis.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import pickle
with open('all_file_dict_test', 'rb') as f:
afd = pickle.load(f)
all_classes = afd.keys()
new_dict = {
"class": [],
"len": []
}
for single_class in all_classes:
for single_doc in afd[single_class]:
doc_class = single_class
doc_len = len(single_doc)
new_dict["class"].append(doc_class)
new_dict["len"].append(doc_len)
df_test = pd.DataFrame(new_dict)
fig1, ax1 = plt.subplots(figsize=(10, 5))
fig1.subplots_adjust(bottom=0.3)
ax1 = sns.boxplot(
data=df_test,
x="class",
y="len"
)
ax1.tick_params(axis='x', labelrotation=90)
ax1.set_xlabel("")
fig1.savefig(
fname="experiment_figures/test_box_plot.eps",
bbox_inches=None,
pad_inches=0.2
)
fig2, ax2 = plt.subplots(figsize=(10, 5))
fig2.subplots_adjust(bottom=0.3)
ax2 = sns.countplot(data=df_test, x="class")
ax2.set_xlabel("")
ax2.tick_params(axis='x', labelrotation=90)
fig2.savefig(
fname="experiment_figures/test_count_plot.eps",
bbox_inches=None,
pad_inches=0.2
)
print("Done!")