for i in range(1000): sess.run(train_step,feed_dict={xs:x_data,ys:y_data}) if i % 50 == 0: #print sess.run(loss,feed_dict={xs:x_data,ys:y_data}) predition_value= sess.run(predition,feed_dict={xs:x_data}) lines =ax.plot(x_data,predition_value,'r-',lw=5) plt.pause(0.5) ax.lines.remove(lines[0])