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

Fixed SparseDML and bootstrap bug. #232

Merged
merged 4 commits into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions econml/dml.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def __init__(self,
n_splits=n_splits,
random_state=random_state)

def fit(self, Y, T, X=None, W=None, sample_weight=None, inference=None):
def fit(self, Y, T, X=None, W=None, sample_weight=None, sample_var=None, inference=None):
"""
Estimate the counterfactual model from data, i.e. estimates functions τ(·,·,·), ∂τ(·,·).

Expand All @@ -649,6 +649,9 @@ def fit(self, Y, T, X=None, W=None, sample_weight=None, inference=None):
Controls for each sample
sample_weight: optional (n,) vector
Weights for each row
sample_var: optional (n, n_y) vector
Variance of sample, in case it corresponds to summary of many samples. Currently
not in use by this method but will be supported in a future release.
inference: string, `Inference` instance, or None
Method for performing inference. This estimator supports 'bootstrap'
(or an instance of :class:`.BootstrapInference`) and 'debiasedlasso'
Expand All @@ -659,7 +662,7 @@ def fit(self, Y, T, X=None, W=None, sample_weight=None, inference=None):
self
"""
# TODO: support sample_var
if sample_weight is not None and inference is not None:
if sample_var is not None and inference is not None:
warn("This estimator does not yet support sample variances and inference does not take "
"sample variances into account. This feature will be supported in a future release.")
check_high_dimensional(X, T, threshold=5, featurizer=self.featurizer,
Expand Down
3 changes: 2 additions & 1 deletion econml/tests/test_dml.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def make_random(is_discrete, d):
fit_cate_intercept=fit_cate_intercept,
discrete_treatment=is_discrete),
True,
[None, 'debiasedlasso']),
[None, 'debiasedlasso'] +
([BootstrapInference(n_bootstrap_samples=20)] if not is_discrete else [])),
(KernelDMLCateEstimator(model_y=WeightedLasso(),
model_t=model_t,
fit_cate_intercept=fit_cate_intercept,
Expand Down