title: Scipy fmin_bfgs Error: Divide-by-zero encountered: rhok assumed large
body: <p>I'm getting the following error when using <strong>fmin_bfgs</strong> (in SciPy) to optimize an unregularized logistic cost function:</p>
  
  <blockquote>
    <p>Divide-by-zero encountered: rhok assumed large</p>
    
    <p>C:\Python27\lib\site-packages\scipy\optimize\optimize.py:828:
    RuntimeWarning: divide by zero encountered in double_scalars   rhok =
    1.0 / (numpy.dot(yk, sk))</p>
    
    <p>Warning: Desired error not necessarily achieved due to precision loss.
             Current function value: 0.693147
             Iterations: 1
             Function evaluations: 27</p>
  </blockquote>
  
  <p>The algorithm (fmin_bfgs) stops after one iteration. What could I be doing wrong? Here's the python code: <a href="https://gist.github.com/4223554" rel="nofollow">https://gist.github.com/4223554</a></p>
  
  <p>Here's the dataset: <a href="https://gist.github.com/4223566" rel="nofollow">https://gist.github.com/4223566</a></p>