Skip to content

Commit 4274f85

Browse files
committed
validate optuna settings to ensure keys are dictionaries
1 parent 0913b1b commit 4274f85

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doubleml/double_ml.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,10 @@ def _validate_optuna_setting_keys(self, optuna_settings):
11961196
+ "."
11971197
)
11981198

1199+
for key in allowed_learner_keys:
1200+
if key in optuna_settings and not isinstance(optuna_settings[key], dict):
1201+
raise TypeError(f"Optuna settings for '{key}' must be a dict.")
1202+
11991203
def _validate_optuna_param_space(self, ml_param_space):
12001204
"""Validate learner keys provided in the Optuna parameter space dictionary."""
12011205

0 commit comments

Comments
 (0)