Skip to content

Commit a995589

Browse files
Fix sorting order in aspect score for Companion, ComparERSub (#684)
1 parent d94ed5a commit a995589

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cornac/models/companion/recom_companion.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ class Companion(Recommender):
10261026
np.repeat(range(n_items), n_top_aspects).reshape(
10271027
n_items, n_top_aspects
10281028
),
1029-
ts3[:, :-1].argsort(axis=1)[::-1][:, :n_top_aspects],
1029+
ts3[:, :-1].argsort(axis=1)[:, ::-1][:, :n_top_aspects],
10301030
]
10311031
item_scores = (
10321032
self.alpha * top_aspect_scores.mean(axis=1) + (1 - self.alpha) * ts3[:, -1]

cornac/models/comparer/recom_comparer_sub.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ class ComparERSub(MTER):
769769
np.repeat(range(self.num_items), n_top_aspects).reshape(
770770
self.num_items, n_top_aspects
771771
),
772-
ts3[:, :-1].argsort(axis=1)[::-1][:, :n_top_aspects],
772+
ts3[:, :-1].argsort(axis=1)[:, ::-1][:, :n_top_aspects],
773773
]
774774
known_item_scores = (
775775
self.alpha * top_aspect_scores.mean(axis=1) + (1 - self.alpha) * ts3[:, -1]

0 commit comments

Comments
 (0)