Skip to content

Patch for errors introduced in the sparse label binarizer#3314

Closed
hamsal wants to merge 7 commits intoscikit-learn:masterfrom
hamsal:sprs-lbl-bin-patch
Closed

Patch for errors introduced in the sparse label binarizer#3314
hamsal wants to merge 7 commits intoscikit-learn:masterfrom
hamsal:sprs-lbl-bin-patch

Conversation

@hamsal
Copy link
Copy Markdown
Contributor

@hamsal hamsal commented Jun 25, 2014

The error:

======================================================================
ERROR: Test that ovr works with classes that are always present or absent
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/anaconda/envs/testenv/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/tests/test_multiclass.py", line 73, in test_ovr_always_present
    assert_warns(UserWarning, ovr.fit, X, y)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/utils/testing.py", line 135, in assert_warns
    result = func(*args, **kw)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/multiclass.py", line 202, in fit
    n_jobs=self.n_jobs)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/multiclass.py", line 92, in fit_ovr
    for i in range(Y.shape[1]))
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/externals/joblib/parallel.py", line 644, in __call__
    self.dispatch(function, args, kwargs)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/externals/joblib/parallel.py", line 391, in dispatch
    job = ImmediateApply(func, args, kwargs)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/externals/joblib/parallel.py", line 129, in __init__
    self.results = func(*args, **kwargs)
  File "/home/travis/build/scikit-learn/scikit-learn/sklearn/multiclass.py", line 57, in _fit_binary
    str(classes[c]))
TypeError: list indices must be integers, not numpy.float64
----------------------------------------------------------------------

@hamsal hamsal mentioned this pull request Jun 25, 2014
17 tasks
@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 4ff2daa on hamsal:sprs-lbl-bin-patch into * on scikit-learn:master*.

@jnothman
Copy link
Copy Markdown
Member

So the problem appears when a label indicator matrix is passed into the label binarizer...

@hamsal
Copy link
Copy Markdown
Contributor Author

hamsal commented Jun 25, 2014

@jnothman do you know of a way to cast the dtype of a numpy array in numpy 1.6.2? the more recent versions of numpy are passing in the Travis as of now. I am trying other methods of casting.

@jnothman
Copy link
Copy Markdown
Member

See sklearn.utils.astype

On 25 June 2014 17:19, hamsal notifications@github.com wrote:

@jnothman https://github.com/jnothman do you know of a way to cast the
dtype of a numpy array in numpy 1.6.2? the more recent versions of numpy
are passing in the Travis as of now.


Reply to this email directly or view it on GitHub
#3314 (comment)
.

@jnothman
Copy link
Copy Markdown
Member

merged as 7a70e0f

@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling ac1af5b on hamsal:sprs-lbl-bin-patch into * on scikit-learn:master*.

@jnothman jnothman closed this Jun 25, 2014
@arjoly
Copy link
Copy Markdown
Member

arjoly commented Jun 26, 2014

Great! Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants