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

[Experimental] Introduce ImplicitBPRWrapper model #232

Merged
merged 8 commits into from
Jan 13, 2025

Conversation

chezou
Copy link
Contributor

@chezou chezou commented Dec 11, 2024

Description

Closes #132

As a first step, don't support features at this moment since it requires to additional design for CPU implementation because CPU BPR class is fully Cythonized.

While I tried to keep deterministic for unit tests, BPR updates random states every fit, so I gave up some tests. Some tests may flakey.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Optimization

How Has This Been Tested?

Before submitting a PR, please check yourself against the following list. It would save us quite a lot of time.

  • Have you read the contribution guide?
  • Have you updated the relevant docstrings? We're using Numpy format, please double-check yourself
  • Does your change require any new tests?
  • Have you updated the changelog file?

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9b3992e) to head (a1cdd33).
Report is 87 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main      #232     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files           45        60     +15     
  Lines         2242      3970   +1728     
===========================================
+ Hits          2242      3970   +1728     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chezou chezou force-pushed the feature/bpr branch 5 times, most recently from 1fa6a73 to 2f096b6 Compare December 12, 2024 00:51
@chezou chezou changed the title Introduce ImplicitBPRWrapper model [Experimental] Introduce ImplicitBPRWrapper model Dec 12, 2024
@chezou chezou marked this pull request as ready for review December 12, 2024 01:15
pyproject.toml Outdated Show resolved Hide resolved
rectools/models/implicit_bpr.py Outdated Show resolved Hide resolved
rectools/models/implicit_bpr.py Outdated Show resolved Hide resolved
tests/models/test_implicit_bpr.py Outdated Show resolved Hide resolved
@blondered
Copy link
Collaborator

Hi @chezou! Thank you so much for this PR, this is very profound. I couldn't find any fixes for non deterministic behaviour. So just did a few small comments.
@feldlime is also looking at this.

Fixing the comments

Co-authored-by: Daria <[email protected]>
@chezou
Copy link
Contributor Author

chezou commented Jan 10, 2025

I found the RTD error:

poetry export -f requirements.txt -o requirements.txt -E all --without-hashes
The command "export" does not exist.

This is because Poetry no longer supports export command itself and need to install plugin.
https://python-poetry.org/docs/cli/#export

However, poetry export is not stable enough, and I suggested to change on #227 (comment)

While using of whitelist/blacklist is not recommended[1], the
consistency is preferred. This commit changes the term `allowlist` to
`whitelist` in the test file.

[1]: https://www.acm.org/diversity-inclusion/words-matter
Copy link
Collaborator

@feldlime feldlime left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @chezou, looks great!

@chezou
Copy link
Contributor Author

chezou commented Jan 12, 2025

Thanks for the review!

Note that I tried to stabilize the test as much as possible e70ef91, however, I see some flakiness presumably due to lack of holding initial random state like rectools-lightfm.
If we face flaky test issues, let's skip them.

@blondered blondered merged commit 5c43ac8 into MobileTeleSystems:main Jan 13, 2025
8 checks passed
@chezou chezou deleted the feature/bpr branch January 13, 2025 15:27
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.

implicit BPR-MF wrapper model
3 participants