]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): use scipy gmean
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 27 May 2025 14:03:09 +0000 (16:03 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 27 May 2025 14:03:09 +0000 (16:03 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py

index 7e0d167e7d5a9052bb503b875160b2fb010253f8..b2fe5a57755559be98830516f9e69bf43da4f34a 100644 (file)
@@ -469,10 +469,8 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                     )
                 )
             elif metric == "geometric_mean":
-                # 1.0 = np.prod(ideal_point) ** (1.0 / ideal_point.shape[0])
-                return 1.0 - np.prod(normalized_matrix, axis=1) ** (
-                    1.0 / normalized_matrix.shape[1]
-                )
+                # 1.0 = sp.stats.gmean(ideal_point)
+                return 1.0 - sp.stats.gmean(normalized_matrix, axis=1)
             elif metric == "hypervolume":
                 # 1.0 = np.prod(ideal_point)
                 return 1.0 - np.prod(normalized_matrix, axis=1)