tgb_mrr_hits
¶
MRR and Hits@k of positive scores ranked against their negative scores, as TGB.
The rank of a positive is 1 + (#negatives scoring higher + #negatives
scoring at least as high) / 2: a positive tied with m negatives gets
the average of its best (first) and worst (last) possible ranks among them,
as TGB (and OGB). The reciprocal ranks and the hits are float32 and
averaged in float32, as TGB with NumPy inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_pred_pos
|
ArrayLike
|
Score of each positive edge, shape |
required |
y_pred_neg
|
ArrayLike
|
Scores of the negative edges of each positive, shape
|
required |
k
|
int
|
The |
10
|
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
The mean reciprocal rank and the Hits@k. |
Source code in mlx_graphs/metrics/tgb.py
from mlx_graphs.metrics import tgb_mrr_hits · mlx_graphs/metrics/tgb.py