)
return best_model
except Exception as e:
- logger.error(f"Error loading best model: {e}", exc_info=True)
+ logger.error(f"Error loading best model: {repr(e)}", exc_info=True)
logger.info("Couldn't find best model, using final model instead.")
except Exception as e:
time_spent = time.time() - start_time
logger.error(
- f"Hyperopt {study_name} failed ({time_spent:.2f} secs): {e}",
+ f"Hyperopt {study_name} failed ({time_spent:.2f} secs): {repr(e)}",
exc_info=True,
)
hyperopt_failed = True
json.dump(best_trial_params, write_file, indent=4)
except Exception as e:
logger.error(
- f"Error saving best trial params to {best_trial_params_path}: {e}",
+ f"Error saving best trial params to {best_trial_params_path}: {repr(e)}",
exc_info=True,
)
raise
get_optuna_study_model_parameters,
largest_divisor,
round_to_nearest_int,
+ soft_extremum,
zigzag,
)
callback()
except Exception as e:
logger.error(
- f"Error executing optuna {pair} {namespace} callback: {str(e)}",
+ f"Error executing optuna {pair} {namespace} callback: {repr(e)}",
exc_info=True,
)
finally:
return threshold_func(values)
except Exception as e:
logger.warning(
- f"Failed to apply skimage threshold function {threshold_func.__name__} on series {series.name}: {str(e)}. Falling back to median",
+ f"Failed to apply skimage threshold function {threshold_func.__name__} on series {series.name}: {repr(e)}. Falling back to median",
exc_info=True,
)
return np.median(values)
except Exception as e:
time_spent = time.time() - start_time
logger.error(
- f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): {str(e)}",
+ f"Optuna {pair} {namespace} {objective_type} objective hyperopt failed ({time_spent:.2f} secs): {repr(e)}",
exc_info=True,
)
return
)
elif isinstance(value, (int, float)):
formatted_value = format_number(value)
+ else:
+ formatted_value = repr(value)
logger.info(
f"Optuna {pair} {namespace} {objective_type} objective hyperopt | {key:>20s} : {formatted_value}"
)
storage = self.optuna_storage(pair)
except Exception as e:
logger.error(
- f"Failed to create optuna storage for study {study_name}: {str(e)}",
+ f"Failed to create optuna storage for study {study_name}: {repr(e)}",
exc_info=True,
)
return None
)
except Exception as e:
logger.error(
- f"Failed to create optuna study {study_name}: {str(e)}", exc_info=True
+ f"Failed to create optuna study {study_name}: {repr(e)}", exc_info=True
)
return None
json.dump(self.get_optuna_params(pair, namespace), write_file, indent=4)
except Exception as e:
logger.error(
- f"Failed to save optuna {namespace} best params for {pair}: {str(e)}",
+ f"Failed to save optuna {namespace} best params for {pair}: {repr(e)}",
exc_info=True,
)
raise
try:
return pattern.format(**duration)
except (KeyError, ValueError) as e:
- raise ValueError(f"Invalid pattern '{pattern}': {e}")
+ raise ValueError(f"Invalid pattern '{pattern}': {repr(e)}")
def set_freqai_targets(
self, dataframe: DataFrame, metadata: dict[str, Any], **kwargs
return trade_kama_natr_values[-1]
except Exception as e:
logger.warning(
- f"Failed to calculate trade NATR KAMA for pair {pair}: {str(e)}. Falling back to last trade NATR value",
+ f"Failed to calculate trade NATR KAMA for pair {pair}: {repr(e)}. Falling back to last trade NATR value",
exc_info=True,
)
return label_natr.iloc[-1]
callback()
except Exception as e:
logger.error(
- f"Error executing callback for {pair}: {str(e)}", exc_info=True
+ f"Error executing callback for {pair}: {repr(e)}", exc_info=True
)
def custom_stoploss(