calc_popularity_metrics

rectools.metrics.popularity.calc_popularity_metrics(metrics: Dict[str, AvgRecPopularity], reco: DataFrame, prev_interactions: DataFrame) Dict[str, float][source]

Calculate popularity metrics (only AvgRP now).

Warning: It is not recommended to use this function directly. Use calc_metrics instead.

Parameters
  • metrics (dict(str -> PopularityMetric)) – Dict of metric objects to calculate, where key is metric name and value is metric object.

  • reco (pd.DataFrame) – Recommendations table with columns Columns.User, Columns.Item, Columns.Rank.

  • prev_interactions (pd.DataFrame) – Table with previous user-item interactions, with columns Columns.User, Columns.Item.

Returns

Dictionary where keys are the same as keys in metrics and values are metric calculation results.

Return type

dict(str->float)