다음은 모델을 훈련시킨 결과입니다.
Epoch 1/4
195/195 [==============================] - 17s 86ms/step - loss: 0.5182 - accuracy: 0.7264
Epoch 2/4
195/195 [==============================] - 25s 129ms/step - loss: 0.3262 - accuracy: 0.8627 - val_loss: 0.3595 - val_accuracy: 0.8411
Epoch 3/4
195/195 [==============================] - 17s 90ms/step - loss: 0.2680 - accuracy: 0.8926
Epoch 4/4
195/195 [==============================] - 24s 121ms/step - loss: 0.2264 - accuracy: 0.9123 - val_loss: 0.3955 - val_accuracy: 0.8282
<tensorflow.python.keras.callbacks.History at 0x21fc6c48710>
이제 모델을 평가해 보겠습니다.
코드 7-20 모델 평가
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)