statisticianinstilettos / recmetrics

A library of metrics for evaluating recommender systems
MIT License
565 stars 98 forks source link

Coverage over 100% #40

Closed vascosmota closed 1 year ago

vascosmota commented 2 years ago

In the example bellow, the coverage measured exceeds 100%, which does not make sense.

This happens when items that are not listed on the catalog are recommended.

> from rcmetrics import prediction_coverage
> prediction_coverage([['x', 'y'], ['w', 'z']], catalog=['w', 'x', 'y'])
133.33
vascosmota commented 2 years ago

A solution could be allowing to set a behaviour when items not present on the catalog are seen. Either ignore them (and do not count them for the coverage measure) or throw an exception when these items are present.

nikosT commented 2 years ago

Why the code uses random.choices for? Shouldn't just count existing input elements?