From 86732328e118b72af8547f5ca268ac86c48f3cc6 Mon Sep 17 00:00:00 2001 From: adamingas Date: Sat, 6 Jan 2024 12:44:38 +0000 Subject: [PATCH] Adds tests for hessian --- tests/test_loss.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_loss.py b/tests/test_loss.py index 873e598..214f1f6 100644 --- a/tests/test_loss.py +++ b/tests/test_loss.py @@ -99,6 +99,17 @@ def test_hessian_ordinal_logistic_nll(): np.array([0.47, 0, 0]), decimal=5) +def test_hessian_ordinal_logistic_nll_monotonic(): + """ + Testing at extreeme values of y_pred where the resolution + of float point arithmetic might fail + """ + y_preds = np.linspace(0,150,100) + y_true = np.array([5]*100) + theta = np.arange(0,18,2) + + hessian = hessian_ordinal_logistic_nll(y_true, y_preds, theta) + def test_lgb_ordinal_loss(): y_preds = np.array([1.5, 15, -38]) y_true = np.array([1, 2, 0])