반응형
1. 딥러닝 Flow
In [5]:
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from keras import optimizers
In [17]:
#데이터셋 설정
time = np.array([1,2,3,4,5])
score= np.array([10,20,30,60,66])
In [18]:
#모델구성
model=Sequential()
model.add(Dense(1,input_dim=1, activation='linear')) #선형회귀
In [19]:
#모델컴파일
sgd= optimizers.SGD(lr=0.01)
model.compile(optimizer=sgd,loss='mse', metrics=['accuracy']) #평가기준:정확도
In [20]:
#모델학습
model.fit(time,score,batch_size=1,epochs=5,shuffle=False)
Out[20]:
In [21]:
#모델예측
print(model.predict([7])) #time이 7일때 예상 score?
In [ ]:
*설명
댓글