]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): refine log messages
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 25 May 2025 10:17:03 +0000 (12:17 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 25 May 2025 10:17:03 +0000 (12:17 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py

index 6367f20b6aa1b24ce4cfb22c30393f4e02ca8c80..1e2dc857fe73080cc2f63fabbb572f9a080c0209 100644 (file)
@@ -473,10 +473,12 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
 
         is_study_single_objective = direction is not None and directions is None
         if is_study_single_objective is True:
-            objective_type = "single objective"
+            objective_type = "single"
         else:
-            objective_type = "multi objective"
-        logger.info(f"Optuna {pair} {namespace} {objective_type} hyperopt started")
+            objective_type = "multi"
+        logger.info(
+            f"Optuna {pair} {namespace} {objective_type} objective hyperopt started"
+        )
         start_time = time.time()
         try:
             study.optimize(
@@ -489,7 +491,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
         except Exception as e:
             time_spent = time.time() - start_time
             logger.error(
-                f"Optuna {pair} {namespace} {objective_type} hyperopt failed ({time_spent:.2f} secs): {str(e)}",
+                f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): {str(e)}",
                 exc_info=True,
             )
             return
@@ -498,7 +500,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
         if is_study_single_objective:
             if not QuickAdapterRegressorV3.optuna_study_has_best_trial(study):
                 logger.error(
-                    f"Optuna {pair} {namespace} {objective_type} hyperopt failed ({time_spent:.2f} secs): no study best trial found"
+                    f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): no study best trial found"
                 )
                 return
             self.set_optuna_value(pair, namespace, study.best_value)
@@ -511,7 +513,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
             best_trial = self.get_multi_objective_study_best_trial("label", study)
             if not best_trial:
                 logger.error(
-                    f"Optuna {pair} {namespace} {objective_type} hyperopt failed ({time_spent:.2f} secs): no study best trial found"
+                    f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): no study best trial found"
                 )
                 return
             self.set_optuna_values(pair, namespace, best_trial.values)
@@ -521,11 +523,11 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
                 **self.get_optuna_params(pair, namespace),
             }
         logger.info(
-            f"Optuna {pair} {namespace} {objective_type} done ({time_spent:.2f} secs)"
+            f"Optuna {pair} {namespace} {objective_type} objective done ({time_spent:.2f} secs)"
         )
         for key, value in study_results.items():
             logger.info(
-                f"Optuna {pair} {namespace} {objective_type} hyperopt | {key:>20s} : {value}"
+                f"Optuna {pair} {namespace} {objective_type} objective hyperopt | {key:>20s} : {value}"
             )
         self.optuna_save_best_params(pair, namespace)
 
@@ -566,7 +568,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
             storage = self.optuna_storage(pair)
         except Exception as e:
             logger.error(
-                f"Failed to create optuna storage for {study_name}: {str(e)}",
+                f"Failed to create optuna storage for study {study_name}: {str(e)}",
                 exc_info=True,
             )
             return None
index ab310451adaf020c17b530eae82f60d9c07afc78..f4b0b39280b63d5b637591c2a1a028431fd9beca 100644 (file)
@@ -390,7 +390,7 @@ class QuickAdapterV3(IStrategy):
         dataframe[EXTREMA_COLUMN] = 0
         if len(pivots_indices) == 0:
             logger.warning(
-                f"No extrema to label for pair {pair} with label_period_candles {self.get_label_period_candles(pair)} and label_natr_ratio {self.get_label_natr_ratio(pair)}"
+                f"No extrema to label for pair {pair} with label_period_candles {self.get_label_period_candles(pair)} and label_natr_ratio {self.get_label_natr_ratio(pair):.2f}"
             )
         else:
             for pivot_idx, pivot_dir in zip(pivots_indices, pivots_directions):