title: How to paint multiple linear regression with 3d flat
body: <p>How to paint multiple linear regression with 3d flat.</p>
  
  <p>I've tried this problem.<br>
  I used <code>plot()</code> and <code>plot_surface()</code>, but it is not correct.</p>
  
  <p>I think that painted multiple linear must be a 3d flat.</p>
  
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  import matplotlib.pyplot as plt
  from mpl_toolkits.mplot3d import Axes3D
  import numpy as np
  from pandas.io.parsers import read_csv
  
  fig = plt.figure()
  ax = fig.gca(projection='3d')
  
  data = read_csv('price data2.csv', sep=',')
  
  xy = np.array(data, dtype=np.float32)
  x_data = xy[0:500, 1:-1]
  y_data = xy[0:500, [-1]]
  
  X = tf.placeholder(tf.float32, shape=[None, 2])
  Y = tf.placeholder(tf.float32, shape=[None, 1])
  
  W = tf.Variable(tf.random_normal([2, 1]), name="weight")
  b = tf.Variable(tf.random_normal([1]), name="bias")
  
  hypothesis = X[0] * W[0] + X[1] * W[1] + b
  
  cost = tf.reduce_mean(tf.square(hypothesis - Y))
  
  optimizer = tf.train.GradientDescentOptimizer(learning_rate=0.0001)
  train = optimizer.minimize(cost)
  init = tf.global_variables_initializer()
  sess = tf.Session()
  
  sess.run(init)
  
  for step in range(500):
      cost_, hypo_, _ = sess.run([cost, hypothesis, train], feed_dict={X: x_data, Y: y_data})
  
  plt.plot(x_data[:, 1], x_data[:, 0], sess.run(W)[0] * x_data[:, 0] + sess.run(W)[1] * x_data[:, 1] + sess.run(b))
  
  #fail
  #x0, x1 = np.meshgrid(x_data[:, 0], x_data[:, 1])
  #ax.plot_surface(x1, x0, y_data)
  
  
  plt.show()
  </code></pre>