반응형
model( 모델 정의 )-동영상 필기 자료 ][ 테스트 해보기 : Y = 3x , input 자동
개선하기 전 코드 : https://speedr00t.tistory.com/773
model( 모델 정의 )-동영상 필기 자료 ][ 테스트 해보기 : Y = 3x
model( 모델 정의 )-동영상 필기 자료 ][ 테스트 해보기 : Y = 3x 필기내용 : https://speedr00t.tistory.com/770 dictionary][ model( 모델 정의 )-동영상 필기 자료 그 동안 체득한 습관으로는 deep learning 정..
speedr00t.tistory.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# test by kyoung chip, jang | |
# | |
import numpy as np | |
import keras | |
from matplotlib import pyplot | |
def calc( x ) : | |
return( x*3 ) | |
model = keras.Sequential([keras.layers.Dense(units=1,input_shape=[1])]) | |
model.compile( optimizer='sgd',loss='mean_squared_error') | |
# y = 3x | |
x = np.arange( -5.0, 5.0, 1.0) # x = np.array([-5.0,-4.0,..etc] , dtype=float ) | |
y = [ calc( xe ) for xe in x ] # y = np.array([-15.0,-12.0,..etc] , dtype=float ) | |
model.fit( x , y, epochs=500) | |
# y = 3x | |
# x = 10.0 | |
# y = 3 * 10.0 | |
print( model.predict([10.0])) | |
pyplot.plot( x , y ) | |
pyplot.show() |

반응형
'Deep learning > 0x02-simple test' 카테고리의 다른 글
model( 모델 정의 )-동영상 필기 자료 ][ x**2 테스트 해보기 (0) | 2020.01.09 |
---|---|
model( 모델 정의 )-동영상 필기 자료 ][ 테스트 해보기 : Y = 3x (0) | 2020.01.08 |
model( 모델 정의 )-동영상 필기 자료 ][ 테스트 해보기: Y = 2X -1 (0) | 2020.01.08 |