Skip to content

Commit 448c959

Browse files
committed
enhance DMLOptunaResult docstring with detailed attributes and examples
1 parent 1ab7843 commit 448c959

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

doubleml/utils/_tune_optuna.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,49 @@ class DMLOptunaResult:
5353
"""
5454
Container for Optuna search results.
5555
56-
Attributes
56+
This dataclass holds the results of Optuna-based hyperparameter tuning,
57+
including the best estimator, parameters, score, and the complete study history.
58+
59+
Parameters
5760
----------
5861
learner_name : str
5962
Name of the learner passed (e.g., 'ml_g').
63+
6064
params_name : str
6165
Name of the nuisance parameter being tuned (e.g., 'ml_g0').
66+
6267
best_estimator : object
6368
The estimator instance with the best found hyperparameters set (not fitted).
69+
6470
best_params : dict
6571
The best hyperparameters found during tuning.
72+
6673
best_score : float
6774
The best average cross-validation score achieved during tuning.
75+
6876
scoring_method : str or callable
6977
The scoring method used during tuning.
78+
7079
study : optuna.study.Study
7180
The Optuna study object containing the tuning history.
81+
7282
tuned : bool
7383
Indicates whether tuning was performed (True) or skipped (False).
84+
85+
Examples
86+
--------
87+
>>> from doubleml.utils import DMLOptunaResult
88+
>>> # After running Optuna tuning
89+
>>> result = DMLOptunaResult(
90+
... learner_name='ml_g',
91+
... params_name='ml_g0',
92+
... best_estimator=estimator,
93+
... best_params={'max_depth': 5},
94+
... best_score=0.85,
95+
... scoring_method='neg_mean_squared_error',
96+
... study=study,
97+
... tuned=True
98+
... )
7499
"""
75100

76101
learner_name: str

0 commit comments

Comments
 (0)