質問編集履歴
3
脱字
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,7 +58,53 @@
|
|
58
58
|
|
59
59
|
f_train_path = os.getcwd() + '/feature/Session' + fold + '/train/'
|
60
60
|
|
61
|
+
|
62
|
+
|
63
|
+
def hard_label(path):
|
64
|
+
|
61
|
-
|
65
|
+
label=[]
|
66
|
+
|
67
|
+
f_list = list(ii for ii in sorted(glob.glob(path)))
|
68
|
+
|
69
|
+
for file_path in f_list:
|
70
|
+
|
71
|
+
with open(file_path, 'r') as file:
|
72
|
+
|
73
|
+
for line in file:
|
74
|
+
|
75
|
+
line_sp = line.replace('Happiness', '0')
|
76
|
+
|
77
|
+
line_sp = line_sp.replace('Anger', '1')
|
78
|
+
|
79
|
+
line_sp = line_sp.replace('Neutral', '2')
|
80
|
+
|
81
|
+
line_sp = line_sp.replace('Sadness', '3')
|
82
|
+
|
83
|
+
line_sp = line_sp.replace('\n', '')
|
84
|
+
|
85
|
+
line_sp = line_sp.split(',')
|
86
|
+
|
87
|
+
if (len(line_sp)==10):
|
88
|
+
|
89
|
+
if (line_sp[9] == '0') or (line_sp[9] == '1') or (line_sp[9] == '2') or (line_sp[9] == '3'):
|
90
|
+
|
91
|
+
label.append(line_sp[9])
|
92
|
+
|
93
|
+
print(line_sp[0])
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
file.close()
|
98
|
+
|
99
|
+
label = np.array(label)
|
100
|
+
|
101
|
+
label = label.astype('int16')
|
102
|
+
|
103
|
+
#print(label)
|
104
|
+
|
105
|
+
return label
|
106
|
+
|
107
|
+
|
62
108
|
|
63
109
|
def load_data(path):
|
64
110
|
|
@@ -80,15 +126,11 @@
|
|
80
126
|
|
81
127
|
|
82
128
|
|
83
|
-
# 省略
|
84
|
-
|
85
129
|
print(x_train.shape, y_train.shape)
|
86
130
|
|
87
131
|
print(x_test.shape, y_test.shape)
|
88
132
|
|
89
133
|
|
90
|
-
|
91
|
-
# 省略
|
92
134
|
|
93
135
|
# Trains the model for a fixed number of epochs (iterations on a dataset)
|
94
136
|
|
@@ -112,8 +154,6 @@
|
|
112
154
|
|
113
155
|
|
114
156
|
|
115
|
-
# 省略
|
116
|
-
|
117
157
|
def main():
|
118
158
|
|
119
159
|
x_train = load_data(f_train_path)
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
以下のエラーメッセージが発生しました。xとyのサイズを揃えないといけないと思うのですが、
|
8
8
|
|
9
|
-
どう修正すれば良いか調べてみても分からなかったため、どなた
|
9
|
+
どう修正すれば良いか調べてみても分からなかったため、どなたかご教授いただけませんでしょうか?
|
10
10
|
|
11
11
|
|
12
12
|
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,6 +15,10 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
```
|
18
|
+
|
19
|
+
(637, 2913, 40, 1) (762, 4)
|
20
|
+
|
21
|
+
(450, 2913, 40, 1) (450, 4)
|
18
22
|
|
19
23
|
Traceback (most recent call last):
|
20
24
|
|
@@ -78,6 +82,14 @@
|
|
78
82
|
|
79
83
|
# 省略
|
80
84
|
|
85
|
+
print(x_train.shape, y_train.shape)
|
86
|
+
|
87
|
+
print(x_test.shape, y_test.shape)
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
# 省略
|
92
|
+
|
81
93
|
# Trains the model for a fixed number of epochs (iterations on a dataset)
|
82
94
|
|
83
95
|
model_history = model.fit(x=x_train,
|