-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_result.py
More file actions
77 lines (63 loc) · 1.57 KB
/
read_result.py
File metadata and controls
77 lines (63 loc) · 1.57 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os
PATH = "result.txt"
MOD = "loss"
f = open(PATH, 'r')
f.readline()
lines = f.readlines()
val_temp = []
train_temp = []
for idx ,line in enumerate(lines):
data = []
data = line.split()
if idx % 2 == 0: # 짝수 번째 acc prec 같은 값 나오는 경우
#print(data[4])
if "VAL" in data[2]:
val_temp.append(data[4])
else:
train_temp.append(data[4])
else:
if idx % 4 == 1:
#print(data)
val_temp.extend([data[2], data[6], data[10], data[14]])
#print(val_temp)
else:
train_temp.extend([data[2], data[6], data[10], data[14]])
#print(val_temp)
#print(data)
#print(val_temp)
#print(train_temp)
f.close()
val=[]
train=[]
temp={}
for idx, number in enumerate(val_temp):
if idx % 5 == 0:
temp['val'] = number
elif idx % 5 == 1:
temp['acc'] = number
elif idx % 5 == 2:
temp['prec'] = number
elif idx % 5 == 3:
temp['rec'] = number
else:
temp['f1'] = number
val.append(temp)
temp={}
#print(val)
for idx, number in enumerate(train_temp):
if idx % 5 == 0:
temp['val'] = number
elif idx % 5 == 1:
temp['acc'] = number
elif idx % 5 == 2:
temp['prec'] = number
elif idx % 5 == 3:
temp['rec'] = number
else:
temp['f1'] = number
train.append(temp)
temp={}
#print(val, train)
# 다 string 이라서 float 으로 변환 요구 된다.
temp = [float(i['val']) for i in val]
temp_2 = [float(i['val']) for i in val]