Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change formats of user_ids and item_ids arg. #1651

Merged
merged 3 commits into from
Feb 19, 2022

Conversation

ywkim92
Copy link
Contributor

@ywkim92 ywkim92 commented Feb 18, 2022

Description

ML model predicts the rating for an user inside prepare_all_prediction function.
But if I run the current code, the following error occurs:
TypeError: Invalid type passed to user_ids parameter. This must be either int or np.int32 array. Type received: <class 'numpy.int64'>
To fix this error,

  1. the types of user_idslink should be changed from int to np.int32 array
  2. the types of item_idslink should be changed from list to np.int32 array

Related Issues

I haven't found yet.

Checklist:

  • I have followed the contribution guidelines and code style for this project.
  • I have added tests covering my contributions.
  • I have updated the documentation accordingly.
  • This PR is being made to staging branch and not to main branch.

@gramhagen
Copy link
Collaborator

should we add the dtype to ensure it's np.int32?
e.g.: np.array(x["uid"], dtype=np.int32)

@ywkim92
Copy link
Contributor Author

ywkim92 commented Feb 18, 2022

should we add the dtype to ensure it's np.int32? e.g.: np.array(x["uid"], dtype=np.int32)

oh i forgot it. Thank you so much!

Copy link
Collaborator

@miguelgfierro miguelgfierro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ywkim92 this is great, thanks, however there is a conflict in the code so we can't merge, can you please review?

@ywkim92
Copy link
Contributor Author

ywkim92 commented Feb 19, 2022

@ywkim92 this is great, thanks, however there is a conflict in the code so we can't merge, can you please review?

Hello, thanks for your kind comments. I resolved the conflict as you said. Could you please check this issue again and git me some hints if the conflict is still not resolved?

@miguelgfierro miguelgfierro merged commit 6c53f92 into recommenders-team:staging Feb 19, 2022
@SafetyMary
Copy link

SafetyMary commented Mar 29, 2022

May i know if the issue has been fixed? If not, is there any work around?
I tried running the lightFM quick start notebook (https://github.com/microsoft/recommenders/blob/main/examples/02_model_hybrid/lightfm_deep_dive.ipynb)
and got the error on

with Timer() as test_time:
all_predictions = prepare_all_predictions(data, uid_map, iid_map,
interactions=train_interactions,
model=model1,
num_threads=NO_THREADS)

TypeError: Invalid type passed to user_ids parameter. This must be either int or np.int32 array. Type received: <class 'numpy.int64'>

System version: 3.8.13 (default, Mar 28 2022, 06:59:08) [MSC v.1916 64 bit (AMD64)]
LightFM version: 1.16

@miguelgfierro
Copy link
Collaborator

SafetyMary if you install recommenders from main, the code in this PR should be in. We will do a release in PyPI soon that will include this

@SafetyMary
Copy link

Have updated to the lastest 1.1.0 ver through pip but the issue still presists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants