다음은 모델 훈련을 출력한 결과입니다.
Epoch 1/4
195/195 [==============================] - 5s 27ms/step - loss: 0.6249 - accuracy: 0.6134
Epoch 2/4
195/195 [==============================] - 8s 42ms/step - loss: 0.3543 - accuracy: 0.8494 - val_loss: 0.4064 - val_accuracy: 0.8224
Epoch 3/4
195/195 [==============================] - 5s 27ms/step - loss: 0.1926 - accuracy: 0.9270
Epoch 4/4
195/195 [==============================] - 7s 37ms/step - loss: 0.0828 - accuracy: 0.9709 - val_loss: 0.6795 - val_accuracy: 0.7970
<tensorflow.python.keras.callbacks.History at 0x21fad010240>
이제 모델에 대한 평가를 해 보겠습니다.
코드 7-8 모델 평가
print("훈련 데이터셋 평가...")
(loss, accuracy) = model.evaluate(train_data, verbose=0) ------ ①
print("loss={:.4f}, accuracy: {:.4f}%".format(loss,accuracy * 100))
print("테스트 데이터셋 평가...")
(loss, accuracy) = model.evaluate(test_data, verbose=0)
print("loss={:.4f}, accuracy: {:.4f}%".format(loss,accuracy * 100))
t1 = time.time()
print('시간:', t1-t0)