Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

fix support for sparse matrices #2

Open
ChristianSch opened this issue Nov 30, 2016 · 2 comments
Open

fix support for sparse matrices #2

ChristianSch opened this issue Nov 30, 2016 · 2 comments

Comments

@ChristianSch
Copy link
Owner

ChristianSch commented Nov 30, 2016

A good starting point would be to look at the failing tests regarding sparse matrices here.

@ChristianSch
Copy link
Owner Author

sample_down_label_space of course has the same problem:

# class of "y": <class 'scipy.sparse.lil.lil_matrix'>
Traceback (most recent call last):
…
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 52, in _wrapfunc
    return getattr(obj, method)(*args, **kwds)
  File "/usr/lib/python3.6/site-packages/scipy/sparse/base.py", line 647, in __getattr__
    raise AttributeError(attr + " not found")
AttributeError: take not found

During handling of the above exception, another exception occurred:

  File "experimental_framework.py", line 117, in load_data
    y = sample_down_label_space(y, 10)
  File "/home/user/Documents/dev/skml/skml/datasets/sample_down_label_space.py", line 36, in sample_down_label_space
    return np.take(y, sampled_indices, axis=1)
  File "/usr/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 159, in take
    return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
  File "/usr/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 62, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/usr/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 42, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
numpy.core._internal.AxisError: axis 1 is out of bounds for array of dimension 1

@ChristianSch
Copy link
Owner Author

Problem is, that not all formats of scipy sparse matrices support indexing (like coo or dok). Thus the indexing of columns to take might be a tad more complex than thought.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant