tsdive.eval.RankingMetrics
dataclass
¶
RankingMetrics(
roc_auc: float | None,
pr_auc: float | None,
precision_at_recall: float | None,
n_pos: int,
n_neg: int,
refusal: str | None,
)
Threshold-free metrics of a detector's scores against binary labels.
roc_auc, pr_auc and precision_at_recall are None when
refusal is set. to_dict() rounds every metric to four decimals
and is the row a study publishes.
Methods:
| Name | Description |
|---|---|
to_dict |
The row a study publishes: every metric rounded to four decimals. |
Attributes:
| Name | Type | Description |
|---|---|---|
roc_auc |
float | None
|
|
pr_auc |
float | None
|
|
precision_at_recall |
float | None
|
|
n_pos |
int
|
|
n_neg |
int
|
|
refusal |
str | None
|
|
to_dict
¶
to_dict() -> dict
The row a study publishes: every metric rounded to four decimals.
Examples:
>>> from tsdive.eval import ranking_metrics
>>> row = ranking_metrics([0, 0, 1, 1], [0.1, 0.4, 0.35, 0.8]).to_dict()
>>> row["roc_auc"], row["pr_auc"], row["n_pos"], row["refusal"]
(0.75, 0.8333, 2, None)