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

Implement time_now for sarplus #1719

Merged
merged 8 commits into from
May 24, 2022
Merged

Conversation

simonzhaoms
Copy link
Collaborator

@simonzhaoms simonzhaoms commented May 17, 2022

Description

time_now in SAR+ is not implemented. This PR provides the implementation for time_now.

TODO:

  • Implement time_now
  • Add tests for time_now

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 branch and not to main branch.

@codecov-commenter
Copy link

codecov-commenter commented May 17, 2022

Codecov Report

Merging #1719 (4aad9fa) into staging (8f1e287) will increase coverage by 23.20%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##           staging    #1719       +/-   ##
============================================
+ Coverage     0.00%   23.20%   +23.20%     
============================================
  Files           87       88        +1     
  Lines         9132     9142       +10     
============================================
+ Hits             0     2121     +2121     
- Misses           0     7021     +7021     
Flag Coverage Δ
nightly ?
pr-gate 23.20% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
recommenders/datasets/mind.py 0.00% <0.00%> (ø)
recommenders/datasets/criteo.py 56.60% <0.00%> (+56.60%) ⬆️
recommenders/utils/spark_utils.py 84.61% <0.00%> (+84.61%) ⬆️
recommenders/datasets/movielens.py 66.37% <0.00%> (+66.37%) ⬆️
recommenders/datasets/download_utils.py 90.00% <0.00%> (+90.00%) ⬆️
recommenders/models/newsrec/io/mind_iterator.py 0.00% <0.00%> (ø)
recommenders/models/newsrec/models/base_model.py 0.00% <0.00%> (ø)
recommenders/__init__.py 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f1e287...4aad9fa. Read the comment docs.

Comment on lines +122 to +131
query = self._format("""
SELECT {col_user},
{col_item},
SUM(
{col_rating} *
POW(2, (CAST({col_timestamp} AS LONG) - {time_now}) / {time_decay_half_life})
) AS {col_rating}
FROM {prefix}df_train_input
GROUP BY {col_user}, {col_item}
CLUSTER BY {col_user}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed there is a change and we don't have the exponential anymore. If you get the same data in SAR and SAR+ with the time decay, do you get the same result?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right. Tests to verify are needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added

@simonzhaoms simonzhaoms marked this pull request as draft May 22, 2022 07:35
@simonzhaoms simonzhaoms marked this pull request as ready for review May 23, 2022 07:22
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.

LGTM

@simonzhaoms simonzhaoms enabled auto-merge (squash) May 24, 2022 05:24
@simonzhaoms simonzhaoms disabled auto-merge May 24, 2022 05:25
@simonzhaoms simonzhaoms merged commit edf825f into staging May 24, 2022
@simonzhaoms simonzhaoms deleted the simonz/sarplus/20220517/time-now branch May 24, 2022 05:26
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.

3 participants