GRU 셀은 simpleRNN보다 더 좋아요
이번 연습에서는 코스 1장에서 사용했던 모델을 다시 실행하되, SimpleRNN 셀을 GRU 셀로만 간단히 바꿔서 모델의 정확도를 비교해 보겠습니다.
이 모델은 SimpleRNN 셀을 사용했던 이전 모델과 마찬가지로 에포크 10회로 이미 학습되어 있어요. 모델을 비교할 수 있도록 테스트 세트 (x_test, y_test)와 기존 모델 SimpleRNN_model도 환경에 이미 로드되어 있습니다.
이 연습은 강의의 일부입니다
Keras로 배우는 언어 모델링을 위한 순환 신경망(RNN)
연습 안내
GRU셀을 임포트하세요.- 두 모델의 요약 정보를 출력하세요.
- 각 모델의 정확도를 출력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Import the modules
from tensorflow.keras.layers import ____, Dense
# Print the old and new model summaries
SimpleRNN_model.____
gru_model.____
# Evaluate the models' performance (ignore the loss value)
_, acc_simpleRNN = SimpleRNN_model.evaluate(X_test, y_test, verbose=0)
_, acc_GRU = gru_model.evaluate(X_test, y_test, verbose=0)
# Print the results
print("SimpleRNN model's accuracy:\t{0}".format(____))
print("GRU model's accuracy:\t{0}".format(____))