scxpand.hyperopt.hyperopt_utils#
Utilities for Optuna study optimization and trial management.
Functions
|
Clean up files and directories for a failed trial. |
|
Clean up trial directories for RUNNING trials without results. |
|
Log trial progress to both logger and trials.log file. |
|
Report a score to an Optuna trial and handle pruning. |
|
Save comprehensive study information to JSON file. |
|
Optuna callback for logging and handling different trial states. |
- scxpand.hyperopt.hyperopt_utils.cleanup_failed_trial(study_dir, trial_number)#
Clean up files and directories for a failed trial.
This function only removes trial directories and files - it does not modify Optuna trial states. Trial state management should be handled by Optuna itself.
- scxpand.hyperopt.hyperopt_utils.cleanup_incomplete_trials(study, study_dir)#
Clean up trial directories for RUNNING trials without results.
Any RUNNING trial without results can be safely cleaned up since there are no concurrent processes that could be actively working on them.
This function cleans up trial directories (not Optuna trial states) for trials that: 1. Are in RUNNING state in Optuna database 2. Have no valid results/checkpoint files (indicating incomplete execution)
Note: This does not modify trial states in Optuna - it only cleans up orphaned directories.
- scxpand.hyperopt.hyperopt_utils.log_trial_progress(trial, study_dir)#
Log trial progress to both logger and trials.log file.
- scxpand.hyperopt.hyperopt_utils.report_optuna_trial_result(trial, results, score_metric)#
Report a score to an Optuna trial and handle pruning.
- scxpand.hyperopt.hyperopt_utils.save_study_info(study, study_dir, score_metric)#
Save comprehensive study information to JSON file.
- scxpand.hyperopt.hyperopt_utils.trial_callback(study, trial, study_dir)#
Optuna callback for logging and handling different trial states.