다음은 출력된 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)