0

So I am trying to build a recommender system and found out that the library lightfm offers the functionalities to build it. I went to their site and looked into the documentation and I saw some examples that I copied to test and to see what they do. I am refering to the Movielens implicit feedback recommender example. First Part second part Just to make sure this is what I copied from the site:

import numpy as np
from lightfm import LightFM
from lightfm.evaluation import precision_at_k
from lightfm.evaluation import auc_score

from lightfm.datasets import fetch_movielens

movielens = fetch_movielens()

for key, value in movielens.items():
    print(key, type(value), value.shape)

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))```

and I am getting the following output:
env\lib\site-packages\lightfm\_lightfm_fast.py:9: UserWarning: LightFM was compiled without OpenMP support. Only a single thread will be used.
  warnings.warn(
train <class 'scipy.sparse._coo.coo_matrix'> (943, 1682)
test <class 'scipy.sparse._coo.coo_matrix'> (943, 1682)
item_features <class 'scipy.sparse._csr.csr_matrix'> (1682, 1682)
item_feature_labels <class 'numpy.ndarray'> (1682,)
item_labels <class 'numpy.ndarray'> (1682,)

Basically not outputting the last codes of line which are print statements. It should do the same like their example shown on their site.
Can anyone explain to me what I am doing wrong there ? 

I also tried to copy the exact code in jupyter to see if I get results there. But still the same thing happened there the print statements were missing.

0 Answers0