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

Update TriRank documentation #619

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

lthoang
Copy link
Member

@lthoang lthoang commented May 16, 2024

Description

Related Issues

#618

Checklist:

  • I have added tests.
  • I have updated the documentation accordingly.
  • I have updated README.md (if you are adding a new model).
  • I have updated examples/README.md (if you are adding a new example).
  • I have updated datasets/README.md (if you are adding a new dataset).

@lthoang lthoang linked an issue May 16, 2024 that may be closed by this pull request
@github-actions github-actions bot added the models New models, changes to models label May 16, 2024
@tqtg
Copy link
Member

tqtg commented May 16, 2024

@lthoang there is a failed unit test related to NextItemRecommender. See the log below:

_______________________ TestNextItemRecommender.test_fit _______________________

self = <models.test_recommender.TestNextItemRecommender testMethod=test_fit>

    def test_fit(self):
        dataset = SequentialDataset.from_usit(self.data)
        model = NextItemRecommender("")
        model.fit(dataset)
        model = SPop()
        model.fit(dataset)
        model.score(0, [])
        result = model.rank(0, history_items=[])
>       self.assertTrue((result[0] == [3, 2, 4, 1, 0, 5, 8, 7, 6]).all())
E       AssertionError: False is not true

tests/cornac/models/test_recommender.py:88: AssertionError

There might be some randomness in this test where it passes most of the time but fails rarely?

@lthoang lthoang self-assigned this May 16, 2024
@lthoang lthoang requested a review from tqtg May 16, 2024 19:51
@lthoang
Copy link
Member Author

lthoang commented May 17, 2024

@lthoang there is a failed unit test related to NextItemRecommender. See the log below:

_______________________ TestNextItemRecommender.test_fit _______________________

self = <models.test_recommender.TestNextItemRecommender testMethod=test_fit>

    def test_fit(self):
        dataset = SequentialDataset.from_usit(self.data)
        model = NextItemRecommender("")
        model.fit(dataset)
        model = SPop()
        model.fit(dataset)
        model.score(0, [])
        result = model.rank(0, history_items=[])
>       self.assertTrue((result[0] == [3, 2, 4, 1, 0, 5, 8, 7, 6]).all())
E       AssertionError: False is not true

tests/cornac/models/test_recommender.py:88: AssertionError

There might be some randomness in this test where it passes most of the time but fails rarely?

Investigate this failing case, I find that the ranking results of SPop as follows:

(array([3, 2, 4, 0, 1, 5, 8, 7, 6]), 
array([0.6923077 , 0.6923077 , 0.9230769 , 1., 0.7692308 , 0.3846154 , 0.07692308, 0.07692308, 0.07692308], dtype=float32))

We can see that there are some items having identical scores. Thus we need to rewrite to ensure the test case can pass in those cases. This will be fixed in another PR.

@tqtg tqtg merged commit 55e7f2e into master May 20, 2024
21 of 22 checks passed
@tqtg tqtg deleted the 618-bug-trirank-documentation-xy branch May 20, 2024 17:44
@tqtg tqtg added docs Documentation (Readme, readthedocs) related and removed models New models, changes to models labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation (Readme, readthedocs) related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Trirank documentation X&Y
2 participants