Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cornac
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arthur Batel
cornac
Commits
cd5c63f8
Unverified
Commit
cd5c63f8
authored
1 year ago
by
Trung-Hoang Le
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix failed test case due to different ordering caused by identical scores (#622)
parent
55e7f2e6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/cornac/models/test_recommender.py
+6
-1
6 additions, 1 deletion
tests/cornac/models/test_recommender.py
with
6 additions
and
1 deletion
tests/cornac/models/test_recommender.py
+
6
−
1
View file @
cd5c63f8
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
import
unittest
import
unittest
import
numpy
as
np
from
cornac.data
import
BasketDataset
,
Dataset
,
SequentialDataset
,
Reader
from
cornac.data
import
BasketDataset
,
Dataset
,
SequentialDataset
,
Reader
from
cornac.models
import
MF
,
GPTop
,
SPop
,
NextBasketRecommender
,
NextItemRecommender
from
cornac.models
import
MF
,
GPTop
,
SPop
,
NextBasketRecommender
,
NextItemRecommender
...
@@ -85,7 +87,10 @@ class TestNextItemRecommender(unittest.TestCase):
...
@@ -85,7 +87,10 @@ class TestNextItemRecommender(unittest.TestCase):
model
.
fit
(
dataset
)
model
.
fit
(
dataset
)
model
.
score
(
0
,
[])
model
.
score
(
0
,
[])
result
=
model
.
rank
(
0
,
history_items
=
[])
result
=
model
.
rank
(
0
,
history_items
=
[])
self
.
assertTrue
((
result
[
0
]
==
[
3
,
2
,
4
,
1
,
0
,
5
,
8
,
7
,
6
]).
all
())
self
.
assertTrue
((
result
[
0
][
0
:
3
]
==
[
3
,
2
,
4
]).
all
())
self
.
assertTrue
((
np
.
sort
(
result
[
0
][
3
:
5
])
==
[
0
,
1
]).
all
())
# identical scores, sorting may affect the ordering
self
.
assertTrue
((
result
[
0
][
5
:
6
]
==
[
5
]).
all
())
self
.
assertTrue
((
np
.
sort
(
result
[
0
][
6
:
9
])
==
[
6
,
7
,
8
]).
all
())
# identical scores, sorting may affect the ordering
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment