title: Gradient Descent implementation in Python
body: <p>I got stucked at a point where I am implementing gradient descent in python.</p>
  
  <p>The formula for gradient descent is:</p>
  
  <pre><code>for iter in range(1, num_iters):
      hypo_function = np.sum(np.dot(np.dot(theta.T, X)-y, X[:,iter]))
  
      theta_0 = theta[0] - alpha * (1.0 / m) * hypo_function
      theta_1 = theta[1] - alpha * (1.0 / m) * hypo_function
  </code></pre>
  
  <p>Got an error:</p>
  
  <blockquote>
    <p>---> hypo_function = np.sum(np.dot(np.dot(theta.T, X)-y, X[:,iter]))
    ValueError: shapes (1,97) and (2,) not aligned: 97 (dim 1) != 2 (dim 0)</p>
  </blockquote>
  
  <p>PS: Here my X is (2L, 97L), y is (97L,) theta is (2L,).</p>