Keras 모델
이 연습 문제에서는 keras.models 모듈의 두 클래스를 사용하는 방법을 연습해 볼 거예요. Sequential 클래스로 하나의 모델을 만들고, Model 클래스로 또 다른 모델을 만들어 보세요.
Sequential 클래스는 계층이 순서대로 쌓인다고 가정하기 때문에 더 간단하게 사용할 수 있고, Model 클래스는 더 유연해서 다중 입력, 다중 출력, 그리고 공유 계층(공유 가중치)을 사용할 수 있어요.
Model 클래스를 사용할 때는 입력 계층을 명시적으로 선언해야 하고, Sequential 클래스에서는 input_shape 매개변수로 이를 지정해요.
Sequential, Model, Dense, Input, LSTM, np(numpy) 객체와 모듈은 이미 환경에 로드되어 있어요.
이 연습은 강의의 일부입니다
Keras로 배우는 언어 모델링을 위한 순환 신경망(RNN)
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Instantiate the class
model = ____(name="sequential_model")
# One LSTM layer (defining the input shape because it is the
# initial layer)
model.add(____(128, input_shape=(None, 10), name="LSTM"))
# Add a dense layer with one unit
model.add(____(1, activation="sigmoid", name="output"))
# The summary shows the layers and the number of parameters
# that will be trained
model.____