DeepLearning_Lab03 - 8BitsCoding/RobotMentor GitHub Wiki
# Lab 3 Minimizing Cost
import tensorflow as tf
import matplotlib.pyplot as plt
matplotlib를 설치해야한다. 여기참조
$ pip3 install -U matplotlib
X = [1, 2, 3]
Y = [1, 2, 3]
W = tf.placeholder(tf.float32)
# Our hypothesis for linear model X * W
hypothesis = X * W
# cost/loss function
cost = tf.reduce_mean(tf.square(hypothesis - Y))
hypothesis와 cost가 위와 같은 이유는

# Variables for plotting cost function
W_history = []
cost_history = []
plot에 사용될 변수 선언
# Launch the graph in a session.
with tf.Session() as sess:
for i in range(-30, 50):
curr_W = i * 0.1
curr_cost = sess.run(cost, feed_dict={W: curr_W})
W_history.append(curr_W)
cost_history.append(curr_cost)

참고
식이 왜 나왔는지 도출
