lightfm icon indicating copy to clipboard operation
lightfm copied to clipboard

Cannot get MovieLens labels' correctly

Open baibai25 opened this issue 2 years ago • 2 comments

Hi! Thank you for fix #676! I updated to version 1.17 and tried the tutorial code with the following results.

スクリーンショット 2023-03-23 21 43 28

The label dtype is '<U1', which appears to be incorrect. I ran movielens.py on my Notebook and got the same result.

スクリーンショット 2023-03-23 21 44 02

Suggestion

Probably an error caused by the numpy specification. I suggest following modifications:

https://github.com/lyst/lightfm/blob/688feded0717f289933b95a0134bad6fbe547331/lightfm/datasets/movielens.py#L75

# new
id_feature_labels = np.empty(num_items, dtype=object)

In my Notebook, it works!

スクリーンショット 2023-03-23 21 44 14

baibai25 avatar Mar 23 '23 13:03 baibai25

Here is my environment

- OS: Ubuntu 20.04.1
- Python: 3.9.2
  - numpy: 1.24.2
  - lightfm: 1.17

baibai25 avatar Mar 23 '23 13:03 baibai25

the same problem, and changing from

 id_feature_labels = np.empty(num_items, dtype=str) 

to

 id_feature_labels = np.empty(num_items, dtype=object) 

works

z2z63 avatar Jul 22 '23 07:07 z2z63