Skip to content

Commit 8a79909

Browse files
committed
add docstring for data class
1 parent 915ec4b commit 8a79909

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

doubleml/utils/propensity_score_processing.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,45 @@
1010

1111
@dataclass
1212
class PSProcessorConfig:
13+
"""
14+
Configuration for propensity score processing.
15+
16+
This dataclass holds the configuration parameters used by PSProcessor
17+
for propensity score calibration, clipping, and validation.
18+
19+
Parameters
20+
----------
21+
clipping_threshold : float, default=1e-2
22+
Minimum and maximum bound for propensity scores after clipping.
23+
Must be between 0 and 0.5.
24+
25+
extreme_threshold : float, default=1e-12
26+
Threshold below which propensity scores are considered extreme.
27+
Propensity scores are clipped based on this value when scores are too close to 0 or 1
28+
to avoid numerical instability.
29+
Must be between 0 and 0.5.
30+
31+
calibration_method : {'isotonic', None}, optional
32+
If provided, applies the specified calibration method to
33+
the propensity scores before clipping. Currently supports:
34+
- 'isotonic': Isotonic regression calibration
35+
- None: No calibration applied
36+
37+
cv_calibration : bool, default=False
38+
Whether to use cross-validation for calibration.
39+
Only applies if a calibration method is specified.
40+
Requires calibration_method to be set.
41+
42+
Examples
43+
--------
44+
>>> from doubleml.utils import PSProcessorConfig, PSProcessor
45+
>>> config = PSProcessorConfig(
46+
... clipping_threshold=0.05,
47+
... calibration_method='isotonic',
48+
... cv_calibration=True
49+
... )
50+
>>> processor = PSProcessor.from_config(config)
51+
"""
1352
clipping_threshold: float = 1e-2
1453
extreme_threshold: float = 1e-12
1554
calibration_method: Optional[str] = None

0 commit comments

Comments
 (0)