File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,14 +219,14 @@ def _compute_trim_mask(self, T_pred):
219219 trim_mask : ndarray of shape (n_samples,), dtype bool
220220 True for samples to keep, False for samples to trim.
221221 """
222- # Check for multiple treatments with trimming and bail early
223- if self ._trimming_threshold is not None :
224- if T_pred .shape [1 ] > 2 :
225- warn ("Sample trimming is currently only supported for binary treatment "
226- "(single treatment plus control)." , UserWarning )
227- return np .ones (T_pred .shape [0 ], dtype = bool )
222+ # If no trimming threshold specified, keep all samples
223+ if self ._trimming_threshold is None :
224+ return np .ones (T_pred .shape [0 ], dtype = bool )
228225
229- elif self ._trimming_threshold is None :
226+ # Check for multiple treatments with trimming and bail early
227+ if T_pred .shape [1 ] > 2 :
228+ warn ("Sample trimming is currently only supported for binary treatment "
229+ "(single treatment plus control)." , UserWarning )
230230 return np .ones (T_pred .shape [0 ], dtype = bool )
231231
232232 if self ._trimming_threshold == 'auto' :
Original file line number Diff line number Diff line change @@ -1296,7 +1296,7 @@ def test_auto_trimming_uniform_propensity_full_range(self):
12961296 Y = T + np .random .randn (n ) * 0.5
12971297
12981298 # Use a flexible model that can learn the propensity accurately
1299- # Gradient boosting can fit the non-linear relationship well
1299+ # The propensity is linear in the feature, so just use LinearRegression as the propensity model even though it's a regressor rather than a classifier.
13001300 est = DRLearner (
13011301 model_propensity = LinearRegression (),
13021302 model_regression = LinearRegression (),
@@ -1331,7 +1331,7 @@ def test_auto_trimming_uniform_propensity_narrow_range(self):
13311331 # Generate outcome
13321332 Y = T + np .random .randn (n ) * 0.5
13331333
1334- # Use a flexible model that can learn the propensity accurately
1334+ # The propensity is linear in the feature, so just use LinearRegression as the propensity model even though it's a regressor rather than a classifier.
13351335 est = DRLearner (
13361336 model_propensity = LinearRegression (),
13371337 model_regression = LinearRegression (),
You can’t perform that action at this time.
0 commit comments