더북(TheBook)

다음은 양방향 RNN만 적용한 모델의 결과입니다.

Model: "sequential_4"
________________________________________________________________
Layer (type)                 Output Shape               Param #
================================================================
embedding_2 (Embedding)      (None, None, 64)           523840
________________________________________________________________
bidirectional_2 (Bidirection (None, 128)                66048
________________________________________________________________
dense_16 (Dense)             (None, 64)                 8256
________________________________________________________________
dense_17 (Dense)             (None, 1)                  65
================================================================
Total params: 598,209
Trainable params: 598,209
Non-trainable params: 0
________________________________________________________________

모델을 컴파일하고 훈련시킵니다.

코드 8-24 모델 훈련

model.compile(loss='binary_crossentropy',
              optimizer=tf.keras.optimizers.Adam(1e-4), metrics=['accuracy'])
history = model.fit(train_batches, epochs=5, validation_data=test_batches,
                    validation_steps=30)
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.