From: Jérôme Benoit Date: Wed, 28 May 2025 18:08:03 +0000 (+0200) Subject: feat(qav3): add standardized hellinger distance support to MO trial X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=98e8f61eda66c4ea0877bea400f216dc7e286ce3;p=freqai-strategies.git feat(qav3): add standardized hellinger distance support to MO trial selection Signed-off-by: Jérôme Benoit --- diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index b94572c..2392359 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -45,7 +45,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel): https://github.com/sponsors/robcaulk """ - version = "3.7.72" + version = "3.7.73" @cached_property def _optuna_config(self) -> dict: @@ -432,6 +432,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel): "sqeuclidean", "yule", "hellinger", + "shellinger", "geometric_mean", "harmonic_mean", "power_mean", @@ -517,7 +518,17 @@ class QuickAdapterRegressorV3(BaseRegressionModel): * (np.sqrt(normalized_matrix) - np.sqrt(ideal_point)) ** 2, axis=1, ) - ) + ) / np.sqrt(2.0) + elif metric == "shellinger": + np_sqrt_normalized_matrix = np.sqrt(normalized_matrix) + np_weights = 1 / np.var(np_sqrt_normalized_matrix, axis=0, ddof=1) + return np.sqrt( + np.sum( + np_weights + * (np_sqrt_normalized_matrix - np.sqrt(ideal_point)) ** 2, + axis=1, + ) + ) / np.sqrt(2.0) elif metric in {"geometric_mean", "harmonic_mean", "power_mean"}: p = { "geometric_mean": 0.0, diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index aa47db6..e7afb10 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -60,7 +60,7 @@ class QuickAdapterV3(IStrategy): INTERFACE_VERSION = 3 def version(self) -> str: - return "3.3.75" + return "3.3.76" timeframe = "5m"