tgb_ndcg
¶
NDCG@k of the predicted scores of each node over the classes, averaged
over the nodes, as TGB (sklearn.metrics.ndcg_score(y_true, y_pred,
k=k)).
The gains are the true label weights and the discount of position i
(from 0) is 1 / log2(i + 2) for the first k positions and 0
after. Tied predicted scores share the average gain of their group, and
nodes whose true labels are all zero score 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_true
|
ArrayLike
|
Non-negative true label weights, shape |
required |
y_pred
|
ArrayLike
|
Predicted scores, shape |
required |
k
|
int
|
Only the first |
10
|
Returns:
| Type | Description |
|---|---|
float
|
The mean NDCG@k. |
Source code in mlx_graphs/metrics/tgb.py
from mlx_graphs.metrics import tgb_ndcg · mlx_graphs/metrics/tgb.py