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

Updated surprise_utils.py #1224

Merged

Conversation

zhaisw
Copy link
Contributor

@zhaisw zhaisw commented Oct 29, 2020

Description

Updated surprise_utils.py in order to increase predicting efficiency.
Previous code used the following to iterate users and items:

for user in data[usercol].unique():
        for item in data[itemcol].unique():
...

Updated to:

users = data[usercol].unique()
items = data[itemcol].unique()

for user in users:
        for item in items:
...

The update can avoid DataFrame unique operation in every for-loop step.

Related Issues

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 and not master.

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.

cool, thanks!

@miguelgfierro miguelgfierro merged commit 675be76 into recommenders-team:staging Oct 29, 2020
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.

2 participants