From 752f4d367fc4dc5f67a3ab0e3661e5a4712de172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Gouv=C3=AAa?= Date: Fri, 25 Apr 2025 14:00:28 +0200 Subject: [PATCH] Update ensemble.py In std calculation to get the uncertainty, when the targets are high values, the float16 which was used as default in my calculations, blows up. Included a cast to np.float32 to avoid this problem. --- modnet/models/ensemble.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modnet/models/ensemble.py b/modnet/models/ensemble.py index 907909e4..80fa0e65 100644 --- a/modnet/models/ensemble.py +++ b/modnet/models/ensemble.py @@ -222,7 +222,7 @@ class OR only return the most probable class. arr=np.array(all_predictions), ) - p_std = np.array(all_predictions).std(axis=0) + p_std = np.array(all_predictions, dtype=np.float32).std(axis=0) df_mean = pd.DataFrame(p_mean, index=p.index, columns=p_columns) df_std = pd.DataFrame(p_std, index=p.index, columns=p.columns)