calc_intersection_metrics
- rectools.metrics.intersection.calc_intersection_metrics(metrics: Dict[str, Intersection], reco: DataFrame, ref_reco: Union[DataFrame, Dict[Hashable, DataFrame]]) Dict[str, float][source]
Calculate intersection metrics.
Warning: It is not recommended to use this function directly. Use calc_metrics instead.
- Parameters
metrics (dict(str -> IntersectionMetric)) – 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.
ref_reco (Union[pd.DataFrame, Dict[Hashable, pd.DataFrame]]) – Reference recommendations table(s) with columns Columns.User, Columns.Item, Columns.Rank.
- Returns
Dictionary where keys are the same as keys in metrics and values are metric calculation results.
- Return type
dict(str->float)