Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue- "BadLayout: Invalid layout of the ARFF file, at line ..." #102

Open
j00n162 opened this issue Feb 7, 2020 · 3 comments
Open

Issue- "BadLayout: Invalid layout of the ARFF file, at line ..." #102

j00n162 opened this issue Feb 7, 2020 · 3 comments

Comments

@j00n162
Copy link

j00n162 commented Feb 7, 2020

Hello,

I tried to convert regular arff file format to sparse arff format through liac-arff.
I used the code below:

import arff
fp = open('est1.arff')
data = arff.load(fp)

X = arff.dumps(data)

from scipy import sparse
decoder = arff.ArffDecoder()
d = decoder.decode(X, encode_nominal=True, return_type=arff.COO)
data = d['data'][0]
row = d['data'][1]
col = d['data'][2]
matrix = sparse.coo_matrix((data, (row, col)), shape=(max(row)+1, max(col)+1))

However, it did not work, and the comment in console was "BadLayout: Invalid layout of the ARFF file, at line ..."

I am not sure what the problem is. Would you please help me to solve this issue?
Thank you.

@j00n162 j00n162 closed this as completed Feb 7, 2020
@j00n162 j00n162 reopened this Feb 7, 2020
@j00n162 j00n162 changed the title Issue- Out[]: <Generator object load at ....> Issue- "BadLayout: Invalid layout of the ARFF file, at line ..." Feb 7, 2020
@jnothman
Copy link
Contributor

jnothman commented Feb 8, 2020 via email

@j00n162
Copy link
Author

j00n162 commented Feb 8, 2020

Thank you for your comment. Where can I get a generator?

@jnothman
Copy link
Contributor

jnothman commented Feb 8, 2020

Sorry, I was responding to the first version of this issue which complained that the output of loading was a Generator.

If your data is not a sparse ARFF, attempting COO return type will raise a BadLayout. Instead, load it dense, then convert to sparse.

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

No branches or pull requests

2 participants