RecTools
RecTools copied to clipboard
Metrics. Added Pfound
trafficstars
Implemented a ranking metric PFound@k:
$$pFound@K = \sum_{i=1}^{k} pLook[i]\ pRel[i]$$
$$pLook[1] = 1$$
$$pLook[i] = pLook[i-1]\ (1 - pRel[i-1])\ (1 - pBreak)$$
$$pBreak = 0.15$$
- Implemented the calculation of the metric, both in the context of each user, and in the context of the overall metric.
- To calculate this metric, the
Scorecolumn is needed, so I added a condition for the presence of this column to themerge_recofunction. - The calculation of this metric depends on the values of the previous step, so I added a static method that fills in the missed ranks with zero scores. For example, the user has only ranks 1 and 5, to calculate
PFound@6, you need scores at positions 2, 3, and 4 in order to correctly calculatepLook[5]. - Wrote tests for metric PFound.