lyst / lightfm

A Python implementation of LightFM, a hybrid recommendation algorithm.
Apache License 2.0
4.66k stars 679 forks source link

Lightfm 1.17 - kernel dies in Jupyter, Spyder when fitting #690

Open sbildea opened 1 year ago

sbildea commented 1 year ago

Hello,

Under the Anaconda 2023.03 distribution I have installed Lightfm 1.17. The interaction matrix is small, shape (671, 9066) - coming from the small movie lens dataset. When running the code: from scipy import sparse from lightfm import LightFM x = sparse.csr_matrix(interactions.values) model = LightFM(no_components= 30, loss='warp',k=15) model.fit(x,epochs=30,num_threads = 4)

in Jupyter, the kernel dies unexpectedly, a pop-up shows-up: Kernel Restarting The kernel appears to have died. It will restart automatically.

In Spyder I get a similar behaviour, with the kernel restarting. I traced it down to the _run_one_epoch method in lightfm.

Any idea of the potential cause is appreciated.

ehuijzer commented 1 year ago

Maybe you can try without the loss='warp' parameter (using default logistic loss). If it works without the parameter it may be the same issue as I reported in #675.

(edit) Seems duplicate of #684

Xiaomuma001 commented 11 months ago

Microsoft Windows? Then the same thing here. it seems that the 1.17version does not work well on windows, same code runs as expected under ubuntu18(WSL), so I switch my workspace to ubuntu instead of spending more time on solving the window environment issue.

CSFelix commented 5 months ago

I was experiencing the same issue.

Since I have Windows installed on my laptop, I changed the loss parameter from warp to logistic and the code ran properly.

Thank you!!