summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-01-31 13:21:36 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2022-01-31 13:21:36 +0100
commit766e9c5a44eb765c76aa293e10168808d8799a0c (patch)
tree371b1c7c80f319e014e2898cc507c5b22457b090 /lib
parent2d1247d25953e5d1479a6ddc6d7a7145f20a2cc5 (diff)
LMT generation: Catch LinAlg errors (e.g. during SVD), fall back to static
Diffstat (limited to 'lib')
-rw-r--r--lib/parameters.py7
1 files changed, 6 insertions, 1 deletions
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
)