반응형
Notice
Recent Posts
Recent Comments
Link
관리 메뉴

bro's coding

keras.iris(예측 ) 본문

[AI]/python.keras

keras.iris(예측 )

givemebro 2020. 5. 13. 11:24
반응형
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Dense
# iris에 적용(값 예측)

# data 준비
from sklearn.datasets import load_iris

iris=load_iris()
X=iris.data[:,:3]
y=iris.data[:,3]

 

model=Sequential()
model.add(Dense(1,input_shape=(3,),activation='linear'))
model.compile(loss='mse',optimizer='sgd')

model.fit(X,y,epochs=1000)

 

ws=model.get_weights()
ws
[array([[-0.21790431],
        [ 0.22590208],
        [ 0.5348903 ]], dtype=float32), array([-0.1555938], dtype=float32)]

 

plt.plot(model.history.history['loss'])

반응형

'[AI] > python.keras' 카테고리의 다른 글

keras.score  (0) 2020.05.13
keras.mnist(중간층)  (0) 2020.05.13
keras.mnist(중간층X)  (0) 2020.05.13
keras.mnist  (0) 2020.05.13
keras.iris(분류)  (0) 2020.05.13
keras.basic(분류)  (0) 2020.05.13
keras.basic(예측)  (0) 2020.05.13
keras.install  (0) 2020.05.13
Comments