In [1]:
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
X = [1,2,3]
Y = [1,2,3]


W = tf.placeholder(tf.float32)
hypothesis = W*X

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

In [3]:
sess = tf.Session()

sess.run(tf.global_variables_initializer())

W_val = []
cost_val = []

for i in range(-30, 50):
    feed_W = i * 0.1
    curr_cost, curr_W = sess.run([cost, W], feed_dict={W: feed_W})
    W_val.append(curr_W)
    cost_val.append(curr_cost)

In [4]:
plt.plot(W_val, cost_val)


Out[4]:
[<matplotlib.lines.Line2D at 0x11df89a58>]

In [5]:
plt.show()

In [6]:
print("hello")


hello

In [ ]:


In [ ]:


In [ ]:


In [ ]: