<jupyter_start><jupyter_text>jupyter 연습<jupyter_code>import tensorflow as tf
tf.set_random_seed(777)  # for reproducibility<jupyter_output><empty_output><jupyter_text>x_data, y_data 준비<jupyter_code>x1_data = [73., 93., 89., 96., 73.]
x2_data = [80., 88., 91., 98., 66.]
x3_data = [75., 93., 90., 100., 70.]

y_data = [152., 185., 180., 196., 142.]<jupyter_output><empty_output><jupyter_text>placeholder 생성<jupyter_code>x1 = tf.placeholder(tf.float32)
x2 = tf.placeholder(tf.float32)
x3 = tf.placeholder(tf.float32)

Y = tf.placeholder(tf.float32)<jupyter_output><empty_output><jupyter_text>variables 생성<jupyter_code>w1 = tf.Variable(tf.random_normal([1]), name='weight1')
w2 = tf.Variable(tf.random_normal([1]), name='weight2')
w3 = tf.Variable(tf.random_normal([1]), name='weight3')
b = tf.Variable(tf.random_normal([1]), name='bias')<jupyter_output><empty_output><jupyter_text>expression, cost function, train<jupyter_code>hypothesis = x1 * w1 + x2 * w2 + x3 * w3 + b

cost = tf.reduce_mean(tf.square(hypothesis - Y))

optimizer = tf.train.GradientDescentOptimizer(learning_rate=1e-5)
train = optimizer.minimize(cost)<jupyter_output><empty_output><jupyter_text>session 생성하고 run<jupyter_code>sess = tf.Session()
sess.run(tf.global_variables_initializer())
for step in range(2001):
    cost_val, hy_val, _ = sess.run([cost, hypothesis, train],
                                  feed_dict={x1: x1_data, x2: x2_data, x3: x3_data, Y: y_data})
    if step % 10 == 0:
        print(step, "Cost: ", cost_val, "\nPrediction:\n", hy_val)<jupyter_output>0 Cost:  11407.703 
Prediction:
 [63.916138 65.81676  70.42296  78.04809  46.316566]
10 Cost:  34.956184 
Prediction:
 [158.23204 179.21907 182.1386  199.7054  132.82286]
20 Cost:  34.673935 
Prediction:
 [158.4955  179.57722 182.46996 200.06802 133.10493]
30 Cost:  34.496758 
Prediction:
 [158.47446 179.59335 182.46434 200.06367 133.12605]
40 Cost:  34.320503 
Prediction:
 [158.45264 179.6084  182.45775 200.05823 133.14636]
50 Cost:  34.14513 
Prediction:
 [158.43083 179.6234  182.45116 200.05281 133.16661]
60 Cost:  33.970768 
Prediction:
 [158.40913 179.63838 182.44461 200.04741 133.18681]
70 Cost:  33.79736 
Prediction:
 [158.38745 179.65329 182.43805 200.04199 133.20692]
80 Cost:  33.624947 
Prediction:
 [158.36586 179.66815 182.4315  200.03662 133.227  ]
90 Cost:  33.453346 
Prediction:
 [158.34431 179.68298 182.42499 200.03123 133.24704]
100 Cost:  33.282753 
Prediction:
 [158.32283 179.69778 182.41849 200.02588 133.267  ]
110 Cost:  33.11306 
Prediction:
 [158.3014  179.71254 1[...]