lyst / lightfm

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

Unable to load movielens dataset #676

Closed pratikkejriwal closed 1 year ago

pratikkejriwal commented 1 year ago

while following the lightfm example:

from lightfm.datasets import fetch_movielens
movielens = fetch_movielens()

I am getting the following error -

/usr/local/lib/python3.9/site-packages/lightfm/datasets/movielens.py:75: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.  (This may have returned Python scalars in past versions.
  id_feature_labels = np.empty(num_items, dtype=np.object)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/lightfm/datasets/movielens.py", line 208, in fetch_movielens
    ) = _parse_item_metadata(num_items, item_metadata_raw, genres_raw)
  File "/usr/local/lib/python3.9/site-packages/lightfm/datasets/movielens.py", line 75, in _parse_item_metadata
    id_feature_labels = np.empty(num_items, dtype=np.object)
  File "/usr/local/lib/python3.9/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'object'

lib version:

numpy                         1.24.1
lightfm                       1.16
baibai25 commented 1 year ago

I'm having the same issue. Here is my environment

- OS: Ubuntu 20.04.1
- Python: 3.9.2
  - numpy: 1.24.2
  - lightfm: 1.16
baibai25 commented 1 year ago

Oh, it was already fixed! Thank you! https://github.com/lyst/lightfm/commit/635838d03add748f5d4a5d5e366d7cd5cd9d4312

pratikkejriwal commented 1 year ago

solved in version 1.17