더북(TheBook)

다음은 출력된 LSTM 모델의 구조입니다.

Model: "sequential_3"
________________________________________________________________
Layer (type)                 Output Shape              Param #
================================================================
embedding_3 (Embedding)      (None, 200, 128)          1280000
________________________________________________________________
bidirectional (Bidirectional (None, 128)               98816
________________________________________________________________
dropout (Dropout)            (None, 128)               0
________________________________________________________________
dense_3 (Dense)              (None, 1)                 129
================================================================
Total params: 1,378,945
Trainable params: 1,378,945
Non-trainable params: 0
----------------------------------------------------------------

모델에 대한 평가를 위해 정확도(accuracy)와 오차(loss)를 확인해 보겠습니다.

코드 7-26 모델 평가

loss, acc = model.evaluate(x_train, y_train, batch_size=384, verbose=1)
print('Training accuracy', model.metrics_names, acc)
print('Training accuracy', model.metrics_names, loss)
loss, acc = model.evaluate(x_test, y_test, batch_size=384, verbose=1)
print('Testing accuracy', model.metrics_names, acc)
print('Testing accuracy', model.metrics_names, loss)
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.