py-why / py-why/EconML

Only point estimates available

Open
#408 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.8k
Forks
827
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am trying to recover inference intervals after:

cate.fit(Y, T[:,0], X=XW, Z=Z, cache_values=True, inference='auto')

I am using DMLIV.
However, when typing:

cate.const_marginal_effect_interval(XW)

the following error appears:

AttributeError                            Traceback (most recent call last)
<ipython-input-24-f4012d0e6611> in <module>
----> 1 cate.const_marginal_effect_interval(XW, alpha=0.01)[0][:,0]

~/opt/anaconda3/envs/pharma_env/lib/python3.8/site-packages/econml/_ortho_learner.py in const_marginal_effect_interval(self, X, alpha)
    769         X, = check_input_arrays(X)
    770         self._check_fitted_dims(X)
--> 771         return super().const_marginal_effect_interval(X, alpha=alpha)
    772     const_marginal_effect_interval.__doc__ = LinearCateEstimator.const_marginal_effect_interval.__doc__
    773 

~/opt/anaconda3/envs/pharma_env/lib/python3.8/site-packages/econml/_cate_estimator.py in call(self, *args, **kwargs)
    252             name = m.__name__
    253             if self._inference is not None:
--> 254                 return getattr(self._inference, name)(*args, **kwargs)
    255             else:
    256                 raise AttributeError("Can't call '%s' because 'inference' is None" % name)

~/opt/anaconda3/envs/pharma_env/lib/python3.8/site-packages/econml/inference/_inference.py in const_marginal_effect_interval(self, X, alpha)
    132 
    133     def const_marginal_effect_interval(self, X, *, alpha=0.1):
--> 134         return self.const_marginal_effect_inference(X).conf_int(alpha=alpha)
    135 
    136     def const_marginal_effect_inference(self, X):

~/opt/anaconda3/envs/pharma_env/lib/python3.8/site-packages/econml/inference/_inference.py in conf_int(self, alpha)
    868         """
    869         if self.stderr is None:
--> 870             raise AttributeError("Only point estimates are available!")
    871         if np.isscalar(self.point_estimate):
    872             return _safe_norm_ppf(alpha / 2, loc=self.point_estimate, scale=self.stderr),\

AttributeError: Only point estimates are available!

what is going on here?

Thank you

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with econml/_ortho_learner.py and econml/inference/_inference.py, following const_marginal_effect_interval through the inference object for DMLIV. Check how inference='auto' is configured and whether existing tests cover interval estimates; done should clarify or correct the behavior and verify it with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.