Skip to content

Commit

Permalink
Added blb inference option to the OrthoForest
Browse files Browse the repository at this point in the history
* Added Bootstrap of Little Bags inference to the ORF classes
* Added tests and updated notebook
* Fixed the marginal effect shape when T is a vector
* Fixed bugs and reorganized class functionality
  • Loading branch information
Miruna Oprescu committed Jan 28, 2020
1 parent 2b5420f commit 8229674
Show file tree
Hide file tree
Showing 5 changed files with 478 additions and 354 deletions.
5 changes: 2 additions & 3 deletions doc/spec/estimation/forest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ and the `ForestLearners Jupyter notebook <https://github.com/microsoft/EconML/bl
>>> est.fit(Y, T, W, W)
<econml.ortho_forest.ContinuousTreatmentOrthoForest object at 0x...>
>>> print(est.effect(W[:2]))
[[1. ]
[1.2]]
[1.00... 1.19...]

Similarly, we can call :class:`.DiscreteTreatmentOrthoForest`:

Expand All @@ -377,7 +376,7 @@ Similarly, we can call :class:`.DiscreteTreatmentOrthoForest`:
>>> est.fit(Y, T, W, W)
<econml.ortho_forest.DiscreteTreatmentOrthoForest object at 0x...>
>>> print(est.effect(W[:2]))
[1. 1.2]
[1.01... 1.25...]

Let's now look at a more involved example with a high-dimensional set of confounders :math:`W`
and with more realistic noisy data. In this case we can just use the default parameters
Expand Down
21 changes: 21 additions & 0 deletions doc/spec/inference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,27 @@ and the :class:`.ForestDRLearner`. You can enable such intervals by setting ``in
This inference is enabled by our implementation of the :class:`.SubsampledHonestForest` extension to the scikit-learn
:class:`~sklearn.ensemble.RandomForestRegressor`.


OrthoForest Bootstrap of Little Bags Inference
==============================================

For the Orthogonal Random Forest estimators (see :class:`.ContinuousTreatmentOrthoForest`, :class:`.DiscreteTreatmentOrthoForest`),
we provide confidence intervals built via the bootstrap-of-little-bags approach ([Athey2019]_). This technique is well suited for
estimating the uncertainty of the honest causal forests underlying the OrthoForest estimators. You can enable such intervals by setting
``inference='blb'``, e.g.:

.. testcode::

from econml.ortho_forest import ContinuousTreatmentOrthoForest
from econml.sklearn_extensions.linear_model import WeightedLasso
est = ContinuousTreatmentOrthoForest(n_trees=10,
min_leaf_size=3,
model_T=WeightedLasso(alpha=0.01),
model_Y=WeightedLasso(alpha=0.01))
est.fit(y, t, X, W, inference='blb')
point = est.const_marginal_effect(X)
lb, ub = est.const_marginal_effect_interval(X, alpha=0.05)

.. todo::
* Subsampling
* Doubly Robust Gradient Inference
Loading

0 comments on commit 8229674

Please sign in to comment.