Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rectools/model_selection/cross_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def cross_validate( # pylint: disable=too-many-locals
models: tp.Dict[str, ModelBase],
k: int,
filter_viewed: bool,
users: tp.Optional[ExternalIds] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi! Thank you for contribution!

Could you please add the following to your PR:

  1. Make users parameter as the last last one
  2. Add profound testing in tests/model_selection/test_cross_validate.py. Please ensure that math is correctly checked there. We believe that tests are really important
  3. Add your change in CHANGELOG.md

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the feedback, I'm on it.

Copy link
Author

Choose a reason for hiding this comment

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

  • I've moved the users parameter to the last
  • looking into the test_cross_validate.py

items_to_recommend: tp.Optional[ExternalIds] = None,
) -> tp.Dict[str, tp.Any]:
"""
Expand Down Expand Up @@ -115,6 +116,8 @@ def cross_validate( # pylint: disable=too-many-locals
fold_dataset = _gen_2x_internal_ids_dataset(interactions_df_train, dataset.user_features, dataset.item_features)

interactions_df_test = interactions.df.iloc[test_ids] # 1x internal
if users is not None:
interactions_df_test = interactions_df_test[interactions_df_test[Columns.User].isin(users)]
test_users = interactions_df_test[Columns.User].unique() # 1x internal
catalog = interactions_df_train[Columns.Item].unique() # 1x internal

Expand Down