calc_ranking_metrics

rectools.metrics.ranking.calc_ranking_metrics(metrics: Dict[str, Union[NDCG, MAP, MRR]], merged: DataFrame) Dict[str, float][source]

Calculate any ranking metrics (MAP, NDCG and MRR for now).

Works with pre-prepared data.

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

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

  • merged (pd.DataFrame) – Result of merging recommendations and interactions tables. Can be obtained using merge_reco function.

Returns

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

Return type

dict(str->float)