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

sasrec tests #193

Open
wants to merge 10 commits into
base: experimental/sasrec
Choose a base branch
from

Conversation

spirinamayya
Copy link
Contributor

added sasrec test

rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
rectools/models/sasrec.py Outdated Show resolved Hide resolved
Parameters
----------
sessions: List[List[int]]
User interaction sequences.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
User interaction sequences.
User sessions in the form of sequences of items ids.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

Choose a reason for hiding this comment

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

This one missed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

tests/models/test_sasrec.py Outdated Show resolved Hide resolved
from tests.testing_utils import assert_id_map_equal, assert_interactions_set_equal


@pytest.mark.filterwarnings("ignore::pytorch_lightning.utilities.warnings.PossibleUserWarning")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please add comments for this and the next line? (What the warnings are and why do we ignore them)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's quite obvious that it's a pytorch_lightning warning, could you add some details? And also some short explanation why we have this warning and why we ignore it

Copy link
Contributor Author

@spirinamayya spirinamayya Oct 31, 2024

Choose a reason for hiding this comment

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

removed filterwarnings

tests/models/test_sasrec.py Outdated Show resolved Hide resolved
@@ -194,6 +194,10 @@ def recommend(
reco_warm_final = self._reco_to_external(reco_warm, dataset.user_id_map, dataset.item_id_map)
reco_cold_final = self._reco_items_to_external(reco_cold, dataset.item_id_map)

reco_hot_final = self._adjust_reco_types(reco_hot_final, dataset.user_id_map.external_dtype, item_type)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's just pass it like dataset.item_id_map.external_dtype just like we are doing for users

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dataset.item_id_map has type object after _custom_transform_dataset_u2i

Parameters
----------
sessions: List[List[int]]
User interaction sequences.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one missed

# Ignore pytorch_lightning warnings
@pytest.mark.filterwarnings("ignore::pytorch_lightning.utilities.warnings.PossibleUserWarning")
# Ignore non-empty checkpoint directory warnings, SASRec user warnings
@pytest.mark.filterwarnings("ignore::UserWarning")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can just change to on_supported_targets=ignore where you don't want the warnings to be received from recommend method. Let's drop this filtering

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

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