Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit f66187a

Browse files
committed
Enhance testcases for mx.metric.PCC.
1 parent 5a67cc4 commit f66187a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/python/unittest/test_metric.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ def test_pcc():
288288
_, pear = met_pear.get()
289289
np.testing.assert_almost_equal(pcc, pear)
290290

291+
# pcc should also accept pred as scalar rather than softmax vector
292+
# like acc does
293+
met_pcc.reset()
294+
met_pcc.update(labels, [p.argmax(axis=1) for p in preds])
295+
_, chk = met_pcc.get()
296+
np.testing.assert_almost_equal(pcc, chk)
297+
291298
# check multiclass case against reference implementation
292299
CM = [
293300
[ 23, 13, 3 ],

0 commit comments

Comments
 (0)