AI/Tensorflow

Tensorflow 자격증 1번 문제 모델

Urong 2020. 12. 23. 17:06
728x90

데이터 전처리는 따로 없다.

매번 바뀌지만 데이터를 정의 해준다. 

Dense 와 Sequential 를 import를 해준다.

model 생성중

input_shape값은 tuple이 와야하므로 input_shape = [1] or input_shape =(1.) 으로 한다.

input값이 1일 경우 input_shape = 1이다.

#학습 데이터 셋팅
celsius_q = np.array([-40, -10, 0, 8, 15, 22, 38])
fahrenheit_a = np.array([-40, 14, 32, 46, 59, 72, 100])

이렇게 데이터가 주어졌을때 모델링은 다음과 같이 간단히 해주면 된다.

model = tf.keras.Sequential([
    tf.keras.layers.Dense(units=1, input_shape=[1])
])

자세한 설명은 첫번째모델을 아래 포스트에 했었다.

2020/12/16 - [AI/Tensorflow] - 텐서플로우(Tensorflow) 처음 모델 만들기

 

텐서플로우(Tensorflow) 처음 모델 만들기

공부시작~ 구글에서 아래링크의 강의를 알려줘서 들어보기로 했다. Intro to TensorFlow for Deep Learning | Udacity Free Courses Intro to TensorFlow for Deep Learning | Udacity Free Courses Developed by..

iyousys.tistory.com

학습을 시킨다.

model.fit(celsius_q, fahrenheit_a, epochs=100, verbose=0)

예측을 해본다. Predict로 검증한다. 입력값 10.0 이다.

model.predict([10.0])

 

728x90
반응형