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

Update filters.py #281

Merged
merged 7 commits into from
Jan 20, 2021
Merged

Update filters.py #281

merged 7 commits into from
Jan 20, 2021

Conversation

surajiyer
Copy link
Contributor

@surajiyer surajiyer commented Jan 13, 2021

We get a KeyError issue in feature_selection/filters.py L197-203 when certain (treatment, y_label) combinations do not occur naturally in the dataset, e.g., if we never see label=1 for "treatment1".

Proposed changes

We can smooth label counts per treatment in _GetNodeSummary() by adding 1 for (treatment, label) combinations that do not occur naturally in the data. Issue opened @ #280

Types of changes

What types of changes does your code introduce to CausalML?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc. This PR template is adopted from appium.

Smooth label count per treatment in _GetNodeSummary() by adding 1 for (treatment, label) combinations that do not occur naturally in the data.
Fixed ModuleNotFoundError: No module named 'sklearn.utils.testing'
Fixed ModuleNotFoundError: No module named 'sklearn.utils.testing'
Copy link
Collaborator

@paullo0106 paullo0106 left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! Please find my comments inline

@@ -191,7 +198,12 @@ def _GetNodeSummary(data,
for ti in treatment_group_keys:
results.update({ti: {}})
for ci in y_name_keys:
results[ti].update({ci: results_series[ti, ci]})
if smooth:
results[ti].update({ci: results[ti].update({ci: results_series[ti, ci]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems ci will all be None as dictionary updating method doesn't return any value, I don't think that's what you are trying to do here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. That was a clumsy copy-paste job that I overlooked somehow.

causalml/inference/meta/tlearner.py Outdated Show resolved Hide resolved
causalml/inference/tree/models.py Outdated Show resolved Hide resolved
@CLAassistant
Copy link

CLAassistant commented Jan 18, 2021

CLA assistant check
All committers have signed the CLA.

@surajiyer
Copy link
Contributor Author

Currently the build is failing because shap is missing IPython as dependency. There is a PR related to fix this issue with Shap shap/shap#1749

Copy link
Collaborator

@paullo0106 paullo0106 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@paullo0106 paullo0106 marked this pull request as ready for review January 20, 2021 00:57
@paullo0106 paullo0106 merged commit bf187ab into uber:master Jan 20, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants