Skip to content

Commit fa9fedc

Browse files
committed
move output clipping out of compute_propensity_score()
1 parent d6f3ef4 commit fa9fedc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

causalml/propensity.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ def compute_propensity_score(
214214
if treatment_pred is None:
215215
treatment_pred = treatment.copy()
216216
if p_model is None:
217-
p_model = ElasticNetPropensityModel(calibrate=calibrate_p)
217+
p_model = ElasticNetPropensityModel(
218+
clip_bounds=clip_bounds, calibrate=calibrate_p
219+
)
218220

219221
p_model.fit(X, treatment)
220222

@@ -226,7 +228,4 @@ def compute_propensity_score(
226228
logger.info("predict_proba not available, using predict instead")
227229
p = p_model.predict(X_pred)
228230

229-
# force the p values within the range
230-
p = np.clip(p, clip_bounds[0], clip_bounds[1])
231-
232231
return p, p_model

0 commit comments

Comments
 (0)