더북(TheBook)

이제 모델을 다음과 같이 설정합니다. model.summary() 함수를 이용해 현재 설정된 모델의 구조를 살펴보겠습니다.

# 모델의 구조를 설정합니다.
model = Sequential()
model.add(Embedding(5000, 100))
model.add(Dropout(0.5))
model.add(Conv1D(64, 5, padding='valid', activation='relu', strides=1))
model.add(MaxPooling1D(pool_size=4))
model.add(LSTM(55))
model.add(Dense(1))
model.add(Activation('sigmoid'))
model.summary()

실행 결과는 다음과 같습니다.

 

실행 결과

_________________________________________________________________
Layer (type)                  Output Shape             Param #   
=================================================================
embedding_1 (Embedding)       (None, None, 100)        500000    
_________________________________________________________________
dropout_1 (Dropout)           (None, None, 100)        0         
_________________________________________________________________
conv1d_1 (Conv1D)             (None, None, 64)         32064     
_________________________________________________________________
max_pooling1d_1 (MaxPooling1  (None, None, 64)         0         
_________________________________________________________________
lstm_1 (LSTM)                 (None, 55)               26400     
_________________________________________________________________
dense_1 (Dense)               (None, 1)                56        
_________________________________________________________________
activation_1 (Activation)     (None, 1)                0         
=================================================================
Total params: 558,520
Trainable params: 558,520
Non-trainable params: 0
_________________________________________________________________
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.