From 6bccf68be5ff8f79e125fba201235552d2c97c04 Mon Sep 17 00:00:00 2001 From: minhkhul Date: Thu, 30 May 2024 14:38:53 -0400 Subject: [PATCH 1/2] specify solver --- _delphi_utils_python/delphi_utils/weekday.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_delphi_utils_python/delphi_utils/weekday.py b/_delphi_utils_python/delphi_utils/weekday.py index ba5d75815..055812818 100644 --- a/_delphi_utils_python/delphi_utils/weekday.py +++ b/_delphi_utils_python/delphi_utils/weekday.py @@ -93,7 +93,7 @@ def _fit(X, scales, npnums, npdenoms): for scale in scales: try: prob = cp.Problem(cp.Minimize((-ll + lmbda * penalty) / scale)) - _ = prob.solve() + _ = prob.solve(solver=cp.CLARABEL) return b.value except SolverError: # If the magnitude of the objective function is too large, an error is From 74726ed959f0e130d4ceeb70f3c3cabffefaf33f Mon Sep 17 00:00:00 2001 From: minhkhul Date: Fri, 31 May 2024 15:15:53 -0400 Subject: [PATCH 2/2] weekday test change --- _delphi_utils_python/tests/test_weekday.py | 23 +++++----------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/_delphi_utils_python/tests/test_weekday.py b/_delphi_utils_python/tests/test_weekday.py index 52e6f4f7e..9b187e114 100644 --- a/_delphi_utils_python/tests/test_weekday.py +++ b/_delphi_utils_python/tests/test_weekday.py @@ -18,24 +18,11 @@ def test_get_params(self): result = Weekday.get_params(self.TEST_DATA, "den", ["num"], "date", [1], TEST_LOGGER) print(result) - expected_result = [ - -0.05993665, - -0.0727396, - -0.05618517, - 0.0343405, - 0.12534997, - 0.04561813, - -2.27669028, - -1.89564374, - -1.5695407, - -1.29838116, - -1.08216513, - -0.92089259, - -0.81456355, - -0.76317802, - -0.76673598, - -0.82523745, - ] + expected_result = np.array([[-0.05990542, -0.07272124, -0.05618539, + 0.0343087, 0.1253007, 0.04562494, + -2.27662546, -1.8956484, -1.56959677, + -1.29847058, -1.08226981, -0.92099449, + -0.81464459, -0.76322013, -0.7667211,-0.8251475]]) assert np.allclose(result, expected_result) def test_calc_adjustment_with_zero_parameters(self):