Skip to content

Hyperparameter Tuning API

doubleml_pyspark.utils._tune_optuna.DMLOptunaResult dataclass

Container for Optuna search results.

This dataclass holds the results of Optuna-based hyperparameter tuning, including the best estimator, parameters, score, and the complete study history.

Parameters:

Name Type Description Default
learner_name str

Name of the learner passed (e.g., 'ml_g').

required
best_estimator object

The estimator instance with the best found hyperparameters set and fitted on the full dataset used during tuning.

required
tuned bool

Indicates whether tuning was performed (True) or skipped (False).

required
best_params dict

The best hyperparameters found during tuning. Empty dict for untuned models.

None
best_score float | None

The best average cross-validation score achieved during tuning. None for untuned models.

None
study Study | None

The Optuna study object containing the tuning history. None for untuned models.

None
scoring_method str or callable

The scoring method used during tuning. None for untuned models.

None

doubleml_pyspark.utils._tune_optuna._dml_tune_optuna

_dml_tune_optuna(spark_session: SparkSession, estimator: Any, param_space_fn: Callable[[Trial], dict[str, Any]], train_df_features: DataFrame, test_df_features: DataFrame, label_col: str, learner_name: str, scoring_methods: dict, optuna_settings: dict | None = None, storage_level: StorageLevel = StorageLevel.MEMORY_AND_DISK, use_persist: bool = False) -> DMLOptunaResult

Perform Optuna hyperparameter tuning for a given estimator using PySpark DataFrames.