You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please correct me if I wrong.
Currently, the DCG score is calculated with the linear gain function.
discount = 1 / (np.log(np.arange(y_true.shape[1]) + 2) / np.log(log_base))
if k is not None:
discount[k:] = 0
if ignore_ties:
ranking = np.argsort(y_score)[:, ::-1]
ranked = y_true[np.arange(ranking.shape[0])[:, np.newaxis], ranking]
cumulative_gains = discount.dot(ranked.T)
else:
discount_cumsum = np.cumsum(discount)
cumulative_gains = [_tie_averaged_dcg(y_t, y_s, discount_cumsum)
for y_t, y_s in zip(y_true, y_score)]
cumulative_gains = np.asarray(cumulative_gains)
return cumulative_gains
However, in the industry, we use the alternative formulation of DCG as an exponential function, such as gains = 2 ** y_true - 1
The exp function emphasis retrieving the highly relevant docs.
Can we add the alternative formulation of gain?
The text was updated successfully, but these errors were encountered:
I agree that as this transformation is very often used it could be useful to add a parameter that allows applying it. In the meanwhile IIUC it just amounts to providing different gains so this or any other transformation of the gains can be applied to y_true before passing it to ndcg_score: ndcg_score(2 ** y_true - 1, y_score) -- you can see the first parameter as "the true gains"
(detail: if a parameter is added to apply the exponential transformation, the implementation should check that the input gains are not too large)
Describe the workflow you want to enable
Please correct me if I wrong.
Currently, the DCG score is calculated with the linear gain function.
However, in the industry, we use the alternative formulation of DCG as an exponential function, such as
gains = 2 ** y_true - 1
The exp function emphasis retrieving the highly relevant docs.
Can we add the alternative formulation of gain?
The text was updated successfully, but these errors were encountered: