-
Notifications
You must be signed in to change notification settings - Fork 727
Movielens: getnnz() got an unexpected keyword argument 'axis' #87
Description
Hello,
I just started playing around with lightFM, so this can be something that I just missed while trying the Movielens example.
Here is the code that I did following the tutorial available on this link
import numpy as np
from lightfm.datasets import fetch_movielens # movielens dataset
from lightfm.evaluation import * # precision_at_k
from lightfm import *
movielens = fetch_movielens()
train = movielens['train']
test = movielens['test']
model = LightFM(learning_rate=0.05, loss='bpr')
model.fit(train, epochs=10)
train_precision = precision_at_k(model, train, k=10).mean()
test_precision = precision_at_k(model, test, k=10).mean()
train_auc = auc_score(model, train).mean()
test_auc = auc_score(model, test).mean()
print('Precision: train %.2f, test %.2f.' % (train_precision, test_precision))
print('AUC: train %.2f, test %.2f.' % (train_auc, test_auc))
I'm getting this error as output:
Traceback (most recent call last):
File "main.py", line 17, in <module>
train_precision = precision_at_k(model, train, k=10).mean()
File "/Library/Python/2.7/site-packages/lightfm/evaluation.py", line 70, in precision_at_k
precision = precision[test_interactions.getnnz(axis=1) > 0]
TypeError: getnnz() got an unexpected keyword argument 'axis'
I'm fairly thinking that it's a silly mistake from my code; but because I couldn't figure it out, I'm opening this issue.
Thanks!