Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

issue fix for recommend_from_interactions --exclude doesn't work properly #2333

Merged
merged 3 commits into from
Sep 25, 2019

Conversation

dhivyaaxim
Copy link
Contributor

This PR resolves #2044
recommend_from_interactions --exclude doesn't work properly

Copy link
Collaborator

@TobyRoseman TobyRoseman left a comment

Choose a reason for hiding this comment

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

The change looks good to me. Please also add a unit test for this bug, i.e. a test which fails before your change but passes after change.

@dhivyaaxim
Copy link
Contributor Author

dhivyaaxim commented Sep 23, 2019

@TobyRoseman Thanks for your suggestion! Will update unit test and let you know

@dhivyaaxim dhivyaaxim closed this Sep 23, 2019
@dhivyaaxim dhivyaaxim reopened this Sep 23, 2019
Copy link
Collaborator

@TobyRoseman TobyRoseman left a comment

Choose a reason for hiding this comment

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

Thanks @dhivyaaxim for adding a unit test. I've requested a few minor changes. Other than that, looks good.

data=tc.SFrame({'userId':[1,1,1,2,2,2,3,3,3],'movieId':[10,11,12,10,13,14,10,11,14]})
exclude_pairs=tc.SFrame({'movieId':[14]})
observed_data=tc.SFrame({'movieId':[10]})
data_set=tc.item_similarity_recommender.create(data,user_id='userId',item_id='movieId')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is confusing. What you're creating on this line is a model not a data set. I would just call the variable model rather than data_set.

exclude_pairs=tc.SFrame({'movieId':[14]})
observed_data=tc.SFrame({'movieId':[10]})
data_set=tc.item_similarity_recommender.create(data,user_id='userId',item_id='movieId')
observed_data=data_set.recommend_from_interactions(observed_items=observed_data,exclude=exclude_pairs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are recommendations not observed data. I think recommendations makes a lot more sense than observed_data.

observed_data=tc.SFrame({'movieId':[10]})
data_set=tc.item_similarity_recommender.create(data,user_id='userId',item_id='movieId')
observed_data=data_set.recommend_from_interactions(observed_items=observed_data,exclude=exclude_pairs)
assert data['movieId'][8] not in observed_data['movieId']
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this line would be a lot easier to reason about if it was just assert 14 not in observed_data['movieId'].

@dhivyaaxim
Copy link
Contributor Author

Thanks @TobyRoseman All changes are addressed !

@TobyRoseman TobyRoseman merged commit 0d6eb16 into apple:master Sep 25, 2019
@TobyRoseman
Copy link
Collaborator

Thanks @dhivyaaxim

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

recommend_from_interactions --exclude doesn't work properly
3 participants