바뀜

88 바이트 추가됨 ,  2021년 12월 2일 (목) 12:56
잔글
74번째 줄: 74번째 줄:  
keras.models.Sequential() 순차적으로 쌓일 모델 객체를 생성한다.<syntaxhighlight lang="python">
 
keras.models.Sequential() 순차적으로 쌓일 모델 객체를 생성한다.<syntaxhighlight lang="python">
 
from keras.models import Sequential
 
from keras.models import Sequential
 +
from keras import layers  # 층을 불러온다.
    
model = Sequential()
 
model = Sequential()
 
# 필요한 층을 더한다.
 
# 필요한 층을 더한다.
model.add(LSTM(50, return_sequences=True, input_shape=(50,1)))  # 50개 유닛을 갖는 LSTM층 생성.
+
model.add(layers.LSTM(50, return_sequences=True, input_shape=(50,1)))  # 50개 유닛을 갖는 LSTM층 생성.
model.add(Dense(1, activation='linear'))  # 일반 뉴런층 1개. 결과가 1개가 나온다.
+
# 50개 OUT.
 +
model.add(layers.Dense(1, activation='linear'))  # 일반 뉴런층 1개. 결과가 1개가 나온다.
 +
# 1개 OUT.
 
model.compile(loss='mse', optimizer='rmsprop')  # 손실함수 따위를 결정한다.
 
model.compile(loss='mse', optimizer='rmsprop')  # 손실함수 따위를 결정한다.