Skip to content

Commit 6fd4c90

Browse files
committed
add mae to metrax
1 parent 5da8d2e commit 6fd4c90

File tree

6 files changed

+418
-580
lines changed

6 files changed

+418
-580
lines changed

src/metrax/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
AveragePrecisionAtK = ranking_metrics.AveragePrecisionAtK
2525
BLEU = nlp_metrics.BLEU
2626
DCGAtK = ranking_metrics.DCGAtK
27+
MAE = regression_metrics.MAE
2728
MRR = ranking_metrics.MRR
2829
MSE = regression_metrics.MSE
2930
NDCGAtK = ranking_metrics.NDCGAtK
@@ -46,6 +47,7 @@
4647
"AveragePrecisionAtK",
4748
"BLEU",
4849
"DCGAtK",
50+
"MAE",
4951
"MRR",
5052
"MSE",
5153
"NDCGAtK",

src/metrax/metrax_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ class MetraxTest(parameterized.TestCase):
8888
'ks': KS,
8989
},
9090
),
91+
(
92+
'mae',
93+
metrax.MAE,
94+
{'predictions': OUTPUT_LABELS, 'labels': OUTPUT_PREDS},
95+
),
9196
(
9297
'mse',
9398
metrax.MSE,

src/metrax/nnx/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
AveragePrecisionAtK = nnx_metrics.AveragePrecisionAtK
2121
BLEU = nnx_metrics.BLEU
2222
DCGAtK = nnx_metrics.DCGAtK
23+
MAE = nnx_metrics.MAE
2324
MRR = nnx_metrics.MRR
2425
MSE = nnx_metrics.MSE
2526
NDCGAtK = nnx_metrics.NDCGAtK
@@ -43,6 +44,7 @@
4344
"BLEU",
4445
"DCGAtK",
4546
"MRR",
47+
"MAE"
4648
"MSE",
4749
"NDCGAtK",
4850
"Perplexity",

src/metrax/nnx/nnx_metrics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ def __init__(self):
6060
super().__init__(metrax.DCGAtK)
6161

6262

63+
class MAE(NnxWrapper):
64+
"""An NNX class for the Metrax metric MAE."""
65+
66+
def __init__(self):
67+
super().__init__(metrax.MAE)
68+
69+
6370
class MRR(NnxWrapper):
6471
"""An NNX class for the Metrax metric MRR."""
6572

0 commit comments

Comments
 (0)