Skip to content

Updated surprise_utils.py#1224

Merged
miguelgfierro merged 1 commit intorecommenders-team:stagingfrom
zhaisw:Issue1222_SurpriseUtils
Oct 29, 2020
Merged

Updated surprise_utils.py#1224
miguelgfierro merged 1 commit intorecommenders-team:stagingfrom
zhaisw:Issue1222_SurpriseUtils

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