質問編集履歴

1

補足

2021/08/02 03:48

投稿

seyu0930
seyu0930

スコア20

test CHANGED
File without changes
test CHANGED
@@ -52,6 +52,86 @@
52
52
 
53
53
 
54
54
 
55
+
56
+
57
+ 上記のリンクのコードと変更した箇所
58
+
59
+ ```python
60
+
61
+ #accの箇所をaccuracyに変更
62
+
63
+ def plot_loss_accuracy_graph(fit_record):
64
+
65
+ # 青い線で誤差の履歴をプロットします、検証時誤差は黒い線で
66
+
67
+ plt.plot(fit_record.history['loss'], "-D", color="blue", label="train_loss", linewidth=2)
68
+
69
+ plt.plot(fit_record.history['val_loss'], "-D", color="black", label="val_loss", linewidth=2)
70
+
71
+ plt.title('LOSS')
72
+
73
+ plt.xlabel('Epochs')
74
+
75
+ plt.ylabel('Loss')
76
+
77
+ plt.legend(loc='upper right')
78
+
79
+ plt.show()
80
+
81
+
82
+
83
+ # 緑の線で精度の履歴をプロットします、検証時制度は黒い線で
84
+
85
+ plt.plot(fit_record.history['accuracy'],"-o", color="green", label="train_accuracy", linewidth=2)
86
+
87
+ plt.plot(fit_record.history['val_accuracy'],"-o",color="black", label="val_accuracy", linewidth=2)
88
+
89
+ plt.title('ACCURACY')
90
+
91
+ plt.xlabel('Epochs')
92
+
93
+ plt.ylabel('Accuracy')
94
+
95
+ plt.legend(loc="lower right")
96
+
97
+ plt.show()
98
+
99
+ ```
100
+
101
+ ```python
102
+
103
+ #keras.utils.to_categoricalの箇所をnp_utils.to_categoricalに変更
104
+
105
+ from keras.utils import np_utils
106
+
107
+
108
+
109
+ # 学習用教師ラベルデータをOne-hotベクトルに変換します
110
+
111
+ print('Keras変換前学習用教師ラベルデータ train_teacher_labels shape:', train_teacher_labels.shape)
112
+
113
+ train_teacher_labels= np_utils.to_categorical(train_teacher_labels, NUM_CLASSES)
114
+
115
+ print('Keras変換後学習用教師ラベルデータ train_teacher_labels shape:',train_teacher_labels.shape)
116
+
117
+
118
+
119
+ # 検証用教師ラベルデータをOne-hotベクトルに変換します
120
+
121
+ print('Keras変換前検証用教師ラベルデータ test_teacher_labels shape:', test_teacher_labels.shape)
122
+
123
+ print(test_teacher_labels)
124
+
125
+ test_teacher_labels = np_utils.to_categorical(test_teacher_labels, NUM_CLASSES)
126
+
127
+ print('Keras変換後検証用教師ラベルデータ test_teacher_labels shape:',test_teacher_labels.shape)
128
+
129
+ print(test_teacher_labels)
130
+
131
+ ```
132
+
133
+
134
+
55
135
  googlecolabの環境
56
136
 
57
137
  keras2.5.0