Skip to content

[Optuna Checkpoints]  #1215

@Steviey

Description

@Steviey

Description

I can not find any examples how to incorporate optuna checkpoinsts.
This works but not with optuna checkpoints:


study_name = f"study_{myKey}_{part}_{qRank}"
                db_name    = f"{myKey}_{part}_{qRank}.db"
                db_path    = psl.get_script_path(db_name)
                db_path    = f"sqlite:///{db_path}"
                try:
                    study = optuna.create_study(
                        study_name     = study_name,
                        storage        = db_path,  # Ensure the study is stored persistently
                        load_if_exists = True,  # Load the existing study if it already exists
                        direction      = "minimize",  # Or "maximize" depending on your objective
                    )
                    algoConf1 = AutoNHITS.get_default_config(h=horiz, backend="optuna")
                    def config_ov_2(trial):
                        config = {**algoConf1(trial)}
                        config.update({
                            "max_steps":maxSteps,
                            "futr_exog_list":exogNames,
                            "hist_exog_list":exogNames
                            })
                        return config
                    model = AutoNHITS(h=horiz,loss=MAE(),config=config_ov_2,search_alg=optuna.samplers.TPESampler(),backend='optuna',num_samples=folds)
                    models.append(model)
                except Exception as e:
                    print(f"Failed to configure or instantiate MLP for key '{myKey}': {e}")
                    psl.errorLog(pd,myKey,e)

Link

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions