<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Introduction to TensorFlow, fitting point by point
In this notebook, we introduce TensorFlow by fitting a line of the form y=m*x+b point by point. This is a derivation of Jared Ostmeyer's Naked Tensor code. 
Load dependencies and set seeds for reproducibility
Step1:  Create a very small data set
Step2:  Define variables -- the model parameters we'll learn -- and initialize them with "random" values
Step3:  One single point at a time, define the error between the true label and the model's prediction of the label
Step4:  Define optimizer as SSE-minimizing gradient descent
Step5:  Define an operator that will initialize the graph with all available global variables
Step6:  With the computational graph designed, we initialize a session to execute it
Step7:  Calculate the predicted model outputs given the inputs xs
<ASSISTANT_TASK:>
Python Code:
import numpy as np
np.random.seed(42)
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import tensorflow as tf
tf.set_random_seed(42)
Explanation: Introduction to TensorFlow, fitting point by point
In this notebook, we introduce TensorFlow by fitting a line of the form y=m*x+b point by point. This is a derivation of Jared Ostmeyer's Naked Tensor code. 
Load dependencies and set seeds for reproducibility
End of explanation
xs = [0., 1., 2., 3., 4., 5., 6., 7.] # feature (independent variable)
ys = [-.82, -.94, -.12, .26, .39, .64, 1.02, 1.] # labels (dependent variable)
fig, ax = plt.subplots()
_ = ax.scatter(xs, ys)
Explanation: Create a very small data set
End of explanation
m = tf.Variable(-0.5)
b = tf.Variable(1.0)
Explanation: Define variables -- the model parameters we'll learn -- and initialize them with "random" values
End of explanation
total_error = 0.0
for x,y in zip(xs, ys):
    y_model = m*x + b
    total_error += (y-y_model)**2
Explanation: One single point at a time, define the error between the true label and the model's prediction of the label
End of explanation
optimizer_operation = tf.train.GradientDescentOptimizer(learning_rate=0.01).minimize(total_error)
Explanation: Define optimizer as SSE-minimizing gradient descent
End of explanation
initializer_op = tf.global_variables_initializer()
Explanation: Define an operator that will initialize the graph with all available global variables
End of explanation
with tf.Session() as sess:
    
    sess.run(initializer_op)
    
    n_epochs = 10
    
    for iteration in range(n_epochs):
        sess.run(optimizer_operation)
    
    slope, intercept = sess.run([m, b])
slope
intercept
Explanation: With the computational graph designed, we initialize a session to execute it
End of explanation
y_hat = slope*np.array(xs) + intercept
pd.DataFrame(list(zip(ys, y_hat)), columns=['y', 'y_hat'])
fig, ax = plt.subplots()
ax.scatter(xs, ys)
x_min, x_max = ax.get_xlim()
y_min, y_max = intercept, intercept + slope*(x_max-x_min)
ax.plot([x_min, x_max], [y_min, y_max])
_ = ax.set_xlim([x_min, x_max])
Explanation: Calculate the predicted model outputs given the inputs xs
End of explanation
<END_TASK>