<p dir="auto">I think the title is quite self-explanatory. Steps to reproduce this are:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="wget http://openml.liacs.nl/data/download/29/dataset_29_credit-a.arff
python -m scipy.io.arff.arffread dataset_29_credit-a.arff"><pre class="notranslate"><code class="notranslate">wget http://openml.liacs.nl/data/download/29/dataset_29_credit-a.arff
python -m scipy.io.arff.arffread dataset_29_credit-a.arff
</code></pre></div>
<p dir="auto">The problematic lines in the .arff file are 578 and 579, and in scipy 600-606. The problem is that scipy first checks if a line is a comment, then it iterates until it finds a non-comment line. Next it checks if a line is empty, and iterates until it finds a non-empty line. Then, it does not check if this non-empty line is a comment. Changing lines 600-606 to</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for raw in row_iter:
        while r_comment.match(raw) or r_empty.match(raw)::
            raw = next(row_iter)
        row = raw.split(delim)
        yield tuple([convertors[i](row[i]) for i in elems])"><pre class="notranslate"><code class="notranslate">for raw in row_iter:
        while r_comment.match(raw) or r_empty.match(raw)::
            raw = next(row_iter)
        row = raw.split(delim)
        yield tuple([convertors[i](row[i]) for i in elems])
</code></pre></div>
<p dir="auto">would fix this problem. I benchmarked this on an .arff file with MNIST data (240MB, 70000 lines, 785 attributes). The old, broken version took took an average of 21.166 seconds (10 runs), the fixed one seems to be a bit faster, taking only 19.6645 seconds.</p>
<p dir="auto">If you consider this as a bug, I am willing to provide a pull request including a fix.</p>
<p dir="auto">A new <code class="notranslate">least_squares</code> interface for LSQ problems is included as a part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="93165294" data-permission-text="Title is private" data-url="https://github.com/scipy/scipy/issues/5019" data-hovercard-type="pull_request" data-hovercard-url="/scipy/scipy/pull/5019/hovercard" href="https://github.com/scipy/scipy/pull/5019">gh-5019</a></p>
<p dir="auto">However, it should be ensured in the design phase that most important functionality is included in it already from the beginning.</p>
<p dir="auto">Interface wiki page: <a href="https://github.com/nmayorov/bounded-lsq/wiki/Calling-%60leastsq%60-via-generic-interface">https://github.com/nmayorov/bounded-lsq/wiki/Calling-%60leastsq%60-via-generic-interface</a> as regards for MINPACK compatibility.</p>
<p dir="auto">Suggestions presented so far:</p>
<ul dir="auto">
<li>global optimizers should be supported</li>
<li>LBFGSB</li>
</ul>