Closed hieuddo closed 2 months ago
@lthoang @hieuddo one question for these models, is it possible to move the part of computing known_item_scores
at the beginning of the rank
function to the score
function?
@lthoang @hieuddo one question for these models, is it possible to move the part of computing
known_item_scores
at the beginning of therank
function to thescore
function?
@tqtg Could you please elaborate more? Based on my understanding, these models compute ranking scores by weighting the tradeoff between predicted ratings and top-k aspects via the following formula:
$$RankingScore{ij} = \alpha \cdot Rating{ij} + (1-\alpha) \cdot AverageTopKAspects_{ij}$$
We can replace $Rating{ij}$ with score(i, j)
. However, we may not need to recompute the score in $ComparER{sub}$ model as ratings are already computed along with aspect scores.
I was thinking whether we can reuse the rank()
function as implemented by default for all models in Cornac. It seems that these models trying to do rating prediction and top-K recommendation with different scoring mechanisms so we need to overwrite the rank()
function.
@hieuddo the changes look fine to me. @lthoang please help double check the detail. Thank you both.
Description
The new
Recommender.rank()
function addsk
as required value, which breaks some models that do not usek
in ranking evaluation (e.g., ComparER, EFM, LRPPM).I putk
into**kwargs
and usek = kwargs.get("k", -1)
instead.Another option is to addk=None
to incompatible models.I added and updated topK ranking for mentioned models.