CatalogCoverage
- class rectools.metrics.catalog.CatalogCoverage(k: int, normalize: bool = False)[source]
Bases:
MetricAtKCount (or share) of items from catalog that is present in recommendations for all users.
- Parameters
k (int) – Number of items at the top of recommendations list that will be used to calculate metric.
normalize (bool, default
False) – Flag, which says whether to normalize metric or not.
- Inherited-members
Methods
calc(reco, catalog)Calculate metric value.
Attributes
normalize- calc(reco: DataFrame, catalog: Collection[Union[str, int]]) float[source]
Calculate metric value.
- Parameters
reco (pd.DataFrame) – Recommendations table with columns Columns.User, Columns.Item, Columns.Rank.
catalog (collection) – Collection of unique item ids that could be used for recommendations.
- Returns
Value of metric (aggregated for all users).
- Return type
float