From 766e9c5a44eb765c76aa293e10168808d8799a0c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 31 Jan 2022 13:21:36 +0100 Subject: LMT generation: Catch LinAlg errors (e.g. during SVD), fall back to static --- lib/parameters.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/parameters.py b/lib/parameters.py index 1f72700..70e0fd3 100644 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -991,7 +991,12 @@ class ModelAttribute: ) self.model_function = df.StaticFunction(np.mean(data)) return - lmt.fit(fit_parameters, data) + try: + lmt.fit(fit_parameters, data) + except np.linalg.LinAlgError as e: + logger.error(f"LMT generated failed: {e}") + self.model_function = df.StaticFunction(np.mean(data)) + return self.model_function = df.LMTFunction( np.mean(data), lmt, category_to_index, ignore_index ) -- cgit v1.2.3