Skip to content

Commit

Permalink
Merge branch 'master' of github.com:uber/causalml
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandrmgservices committed Jul 26, 2023
2 parents 3ef3c53 + 8a78250 commit d46cf7e
Show file tree
Hide file tree
Showing 17 changed files with 296 additions and 105 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
python-version: ['3.8']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
Expand Down
1 change: 0 additions & 1 deletion causalml/inference/iv/iv_regression.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
import pandas as pd

from causalml.inference.meta.utils import convert_pd_to_np
import statsmodels.api as sm
Expand Down
2 changes: 1 addition & 1 deletion causalml/inference/meta/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def plot_shap_values(
features (optional, np.array): list/array of feature names. If None, an enumerated list will be used.
shap_dict (optional, dict): a dict of shapley value matrices. If None, shap_dict will be computed.
"""
override_checks = False if shap_dict is None else True
override_checks = shap_dict is not None
explainer = Explainer(
method="shapley",
control_name=self.control_name,
Expand Down
1 change: 0 additions & 1 deletion causalml/inference/meta/drlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from xgboost import XGBRegressor

from causalml.inference.meta.base import BaseLearner
from causalml.inference.meta.explainer import Explainer
from causalml.inference.meta.utils import (
check_treatment_vector,
check_p_conditions,
Expand Down
1 change: 0 additions & 1 deletion causalml/inference/meta/rlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
convert_pd_to_np,
get_weighted_variance,
)
from causalml.inference.meta.explainer import Explainer
from causalml.propensity import compute_propensity_score, ElasticNetPropensityModel


Expand Down
1 change: 0 additions & 1 deletion causalml/inference/meta/slearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from copy import deepcopy

from causalml.inference.meta.base import BaseLearner
from causalml.inference.meta.explainer import Explainer
from causalml.inference.meta.utils import check_treatment_vector, convert_pd_to_np
from causalml.metrics import regression_metrics, classification_metrics

Expand Down
1 change: 0 additions & 1 deletion causalml/inference/meta/tlearner.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from xgboost import XGBRegressor

from causalml.inference.meta.base import BaseLearner
from causalml.inference.meta.explainer import Explainer
from causalml.inference.meta.utils import check_treatment_vector, convert_pd_to_np
from causalml.metrics import regression_metrics, classification_metrics

Expand Down
2 changes: 1 addition & 1 deletion causalml/inference/meta/tmle.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def estimate_ate(self, X, treatment, y, p, segment=None, return_ci=False):
ate_lb = []
ate_ub = []

for i, group in enumerate(self.t_groups):
for _, group in enumerate(self.t_groups):
logger.info("Estimating ATE for group {}.".format(group))
w_group = (treatment == group).astype(int)
p_group = p[group]
Expand Down
2 changes: 1 addition & 1 deletion causalml/inference/tree/causal/_builder.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ cdef class DepthFirstCausalTreeBuilder(TreeBuilder):
cdef int init_capacity

if tree.max_depth <= 10:
init_capacity = (2 ** (tree.max_depth + 1)) - 1
init_capacity = int(2 ** (tree.max_depth + 1)) - 1
else:
init_capacity = 2047

Expand Down
2 changes: 1 addition & 1 deletion causalml/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def match(self, data, treatment_col, score_cols):
(pandas.DataFrame): The subset of data consisting of matched
treatment and control group data.
"""
assert type(score_cols) is list, "score_cols must be a list"
assert isinstance(score_cols, list), "score_cols must be a list"
treatment = data.loc[data[treatment_col] == 1, score_cols]
control = data.loc[data[treatment_col] == 0, score_cols]

Expand Down
2 changes: 1 addition & 1 deletion envs/environment-py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: causalml-py37
channels:
- defaults
dependencies:
- pip=21.0.1
- pip
- python=3.7
- setuptools=52.0.0
- graphviz
Expand Down
2 changes: 1 addition & 1 deletion envs/environment-py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: causalml-py38
channels:
- defaults
dependencies:
- pip=21.0.1
- pip
- python=3.8
- setuptools=52.0.0
- pip:
Expand Down
14 changes: 7 additions & 7 deletions envs/environment-py39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: causalml-py39
channels:
- defaults
dependencies:
- pip=21.0.1
- pip
- python=3.9
- setuptools=52.0.0
- numpy=1.22
- pip:
- absl-py==0.12.0
- appnope==0.1.2
Expand Down Expand Up @@ -66,7 +67,6 @@ dependencies:
- nest-asyncio==1.5.1
- notebook==6.3.0
- numba==0.53.1
- numpy==1.20.3
- oauthlib==3.1.0
- opt-einsum==3.3.0
- packaging==20.9
Expand Down Expand Up @@ -100,27 +100,27 @@ dependencies:
- graphviz
- python-utils==2.5.6
- pytz==2021.1
- pyyaml==5.4.1
- pyyaml==6.0.0
- pyzmq==22.0.3
- qtconsole==5.0.3
- qtpy==1.9.0
- requests==2.25.1
- requests-oauthlib==1.3.0
- rsa==4.7.2
- scikit-learn==0.23.2
- scipy==1.4.1
- scikit-learn==1.0.2
- scipy==1.10.0
- seaborn==0.11.1
- send2trash==1.5.0
- shap==0.37.0
- six==1.15.0
- slicer==0.0.3
- statsmodels==0.12.2
- statsmodels==0.13.1
- termcolor==1.1.0
- terminado==0.9.4
- testpath==0.4.4
- threadpoolctl==2.1.0
- toml==0.10.2
- torch==1.8.1
- torch==1.9.0
- tornado==6.1
- tqdm==4.60.0
- traitlets==5.0.5
Expand Down
356 changes: 276 additions & 80 deletions examples/causal_trees_with_synthetic_data.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies = [
"pandas>=0.24.1,<1.4.0",
"scikit-learn<=1.0.2",
"statsmodels>=0.9.0",
"Cython>=0.28.0",
"Cython<=0.29.34",
"seaborn",
"xgboost",
"pydotplus",
Expand Down Expand Up @@ -61,7 +61,7 @@ tf = [
requires = [
"setuptools>=18.0",
"wheel",
"Cython>=0.28.0",
"Cython<=0.29.34",
"numpy<1.24",
"scikit-learn<=1.0.2",
]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
try:
from Cython.Build import cythonize
except ImportError:
dist.Distribution().fetch_build_eggs(["cython>=0.28.0"])
dist.Distribution().fetch_build_eggs(["cython<=0.29.34"])
from Cython.Build import cythonize
import Cython.Compiler.Options

Expand Down

0 comments on commit d46cf7e

Please sign in to comment.