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

AttributeError: 'numpy.ndarray' object has no attribute 'indptr' #20

Open
ks864148379 opened this issue Dec 15, 2016 · 1 comment
Open

Comments

@ks864148379
Copy link

Creating validation dataset of 0.01 of training for adaptive regularization
Traceback (most recent call last):
File "suanfa.py", line 25, in
fm.fit(trainX,trainY)
File "/home/ks/anaconda3/lib/python3.5/site-packages/pyfm/pylibfm.py", line 181, in fit
X_train_dataset = _make_dataset(X_train, train_labels)
File "/home/ks/anaconda3/lib/python3.5/site-packages/pyfm/pylibfm.py", line 239, in _make_dataset
dataset = CSRDataset(X.data, X.indptr, X.indices, y_i, sample_weight)
AttributeError: 'numpy.ndarray' object has no attribute 'indptr'

@mengwenliu
Copy link

check if you add X = X.toarray(), which is wrong.

The following should work:

X = v.fit_transform(data)
y = np.repeat(1.0, X.shape[0])
fm.fit(X, y)

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