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

Vasilis/autoinference #307

Merged
merged 38 commits into from
Nov 11, 2020
Merged

Vasilis/autoinference #307

merged 38 commits into from
Nov 11, 2020

Conversation

vsyrgkanis
Copy link
Collaborator

@vsyrgkanis vsyrgkanis commented Nov 9, 2020

  1. Made default='auto' for many estimators, so that default inference is enabled (fixes inference='auto' #205).
  2. Enabled LinearModelFinalInference at the DMLCateEstimator level, so that if the user uses any model_final that has predict_interval and prediction_stderr they will get inference. This enables use of RLM as final stage with conf intervals.
  3. Added an RLM scikit-learn wrapper.

This enables the following usecase:

from econml.sklearn_extensions.linear_model import StatsModelsRLM
est = DMLCateEstimator(model_y=LassoCV(),
                        model_t=LassoCV(),
                        model_final=StatsModelsRLM(t=1, maxiter=10000, tol=1e-12, fit_intercept=False),
                        featurizer=PolynomialFeatures(degree=1, include_bias=False),
                        random_state=123)
est.fit(Y, T, X, W)
te_pred = est.effect(X_test)
lb, ub= est.effect_interval(X_test)
est.summary()

vasilismsr and others added 17 commits November 7, 2020 08:56
… but rather create auxiliary numpy arrays that store the numerator and denominator of every node. This enables consistent feature_importance calculation and also potentially more accurate shap_values calcualtion.
…ure_importances_. Added tests that the feature_importances_ API is working in test_drlearner and test_dml.
Co-authored-by: Keith Battocchi <kebatt@microsoft.com>
…ree level was causing trouble, since due to sample splitting feature_improtance can many times be negative (increase in variance) due to honesty and sample splitting. Now averaging the un-normalized feature importance. There is still a small caveat in the current version of how we use impurity. Added that as a TODO.
…orest, that now makes feature_importances_ exactly correct and no need to re-implement the method. Now impurities are computed on the estimation sample and replacing the pre-calculated node impurities.
…rallel_add_trees_ of ensemble.py. This leads to 6 fold speed-up as we were doing many slicing operations to sparse matrices before, which are very slow!
…ear model final inference for DMLCateEstimator, to allow for RLM usage
@vsyrgkanis vsyrgkanis added the enhancement New feature or request label Nov 9, 2020
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

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

Love the idea of enabling inference by default when it's efficient. I don't see which changes enable arbitrary linear models in this set of commits - what am I missing?

econml/cate_estimator.py Show resolved Hide resolved
econml/cate_estimator.py Show resolved Hide resolved
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

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

Mostly fine, except for a weird whitespace issue.

econml/drlearner.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

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

LGTM

econml/dml.py Outdated Show resolved Hide resolved
econml/dml.py Outdated Show resolved Hide resolved
econml/dml.py Outdated Show resolved Hide resolved
econml/dml.py Outdated Show resolved Hide resolved
econml/dml.py Outdated Show resolved Hide resolved
vsyrgkanis and others added 5 commits November 11, 2020 13:53
Co-authored-by: Keith Battocchi <kebatt@microsoft.com>
Co-authored-by: Keith Battocchi <kebatt@microsoft.com>
Co-authored-by: Keith Battocchi <kebatt@microsoft.com>
Copy link
Collaborator

@kbattocchi kbattocchi left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@vsyrgkanis vsyrgkanis merged commit a79bdea into master Nov 11, 2020
@vsyrgkanis vsyrgkanis deleted the vasilis/autoinference branch November 16, 2020 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inference='auto'
3 participants