質問編集履歴
2
一文入力漏れがありましたの追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,10 +20,12 @@
|
|
20
20
|
|
21
21
|
```ここに言語名を入力 python
|
22
22
|
|
23
|
+
history = model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs =10)
|
24
|
+
metrics_2 = ['recall','precision']
|
25
|
+
plt.figure(figsize = (10, 5))
|
23
26
|
|
24
|
-
metrics_2 = ['recall','precision']
|
25
27
|
|
26
|
-
|
28
|
+
|
27
29
|
for i in range(len(metrics_2)):
|
28
30
|
|
29
31
|
metric = metrics_2[i]
|
1
画像が添付出来なかったようなのでコードを記載しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,14 +6,39 @@
|
|
6
6
|
### 発生している問題・エラーメッセージ
|
7
7
|
keyerror
|
8
8
|
```
|
9
|
-
エラーメッセージ![イメージ説明]
|
9
|
+
エラーメッセージ![イメージ説明]KeyError Traceback (most recent call last)
|
10
|
+
<ipython-input-14-db522e2f48b0> in <module>()
|
11
|
+
6 plt.title(metric) #グラフのタイトルを表示
|
12
|
+
7
|
13
|
+
----> 8 plt_train= history. history [metric] # historyから訓練データの評価を取り出す
|
14
|
+
9 plt_test = history. history ['val_'+ metric] # historyからテストデータの評価を取り出す
|
10
|
-
|
15
|
+
10
|
16
|
+
|
17
|
+
KeyError: 'recall
|
11
18
|
|
12
19
|
### 該当のソースコード
|
13
20
|
|
14
|
-
```ここに言語名を入力
|
21
|
+
```ここに言語名を入力 python
|
22
|
+
|
23
|
+
|
24
|
+
metrics_2 = ['recall','precision']
|
25
|
+
|
26
|
+
plt.figure(figsize = (10, 5))
|
27
|
+
for i in range(len(metrics_2)):
|
28
|
+
|
29
|
+
metric = metrics_2[i]
|
30
|
+
|
31
|
+
plt.subplot(1, 2, i+1) #figureを1×2のスペースに分け、 i+1番目のスペースを使う
|
32
|
+
plt.title(metric) #グラフのタイトルを表示
|
33
|
+
|
34
|
+
plt_train= history. history [metric] # historyから訓練データの評価を取り出す
|
35
|
+
plt_test = history. history ['val_'+ metric] # historyからテストデータの評価を取り出す
|
36
|
+
|
37
|
+
plt.plot(plt_train, label='training') #訓練データの評価をグラフにプロット
|
38
|
+
plt.plot(plt_test, label='test') #テストデータの評価をグラフにプロット
|
15
|
-
|
39
|
+
plt.legend # ラベルの表示
|
40
|
+
|
16
|
-
|
41
|
+
plt.show() #グラフの表示
|
17
42
|
|
18
43
|
### 試したこと
|
19
44
|
|