다음은 모델을 훈련시킨 결과입니다.
Epoch 1/4
195/195 [==============================] - 23s 120ms/step - loss: 0.5033 - accuracy: 0.7383
Epoch 2/4
195/195 [==============================] - 39s 201ms/step - loss: 0.3166 - accuracy: 0.8670 - val_loss: 0.3613 - val_accuracy: 0.8435
Epoch 3/4
195/195 [==============================] - 24s 124ms/step - loss: 0.2569 - accuracy: 0.8970
Epoch 4/4
195/195 [==============================] - 39s 200ms/step - loss: 0.2165 - accuracy: 0.9168 - val_loss: 0.4122 - val_accuracy: 0.8338
<tensorflow.python.keras.callbacks.History at 0x21f80fd5fd0>
이제 모델을 평가해 보겠습니다.
코드 7-23 모델 평가
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)