Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #891

Merged
merged 6 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion econml/policy/_drlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ def _gen_drpolicy_learner(self):
cv=self.cv,
mc_iters=self.mc_iters,
mc_agg=self.mc_agg,
model_final=PolicyForest(max_depth=self.max_depth,
model_final=PolicyForest(n_estimators=self.n_estimators,
max_depth=self.max_depth,
min_samples_split=self.min_samples_split,
min_samples_leaf=self.min_samples_leaf,
min_weight_fraction_leaf=self.min_weight_fraction_leaf,
Expand Down
4 changes: 2 additions & 2 deletions econml/tests/test_policy_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ def test_non_standard_input(self,):
model_propensity=DummyClassifier(strategy='uniform'),
featurizer=PolynomialFeatures(degree=1, include_bias=False),
cv=GroupKFold(n_splits=2),
n_estimators=20, n_jobs=1, random_state=123).fit(y, T, X=X,
groups=groups)
n_estimators=100, n_jobs=1, random_state=123).fit(y, T, X=X,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for test stability?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because n_estimators was never passed correctly to DRPolicyForest in the past, this has always effectively run with n_estimators=100 (the default value), and the tests don't pass if we actually pass 20 through instead.

groups=groups)
mask = np.abs(Xraw[:, 0]) > .1
np.testing.assert_allclose(pred[mask], forest.predict(Xraw[mask]))
np.testing.assert_allclose(pred_val[mask, 1] - pred_val[mask, 0],
Expand Down