зеркало из https://github.com/py-why/EconML.git
Add python 3.12 to test matrix
Signed-off-by: Keith Battocchi <kebatt@microsoft.com>
This commit is contained in:
Родитель
37db00aaa0
Коммит
7aa509ed3c
|
@ -203,7 +203,7 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11']
|
||||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
||||
kind: [serial, other, dml, main, treatment, ray]
|
||||
exclude:
|
||||
# Serial tests fail randomly on mac sometimes, so we don't run them there
|
||||
|
@ -212,6 +212,9 @@ jobs:
|
|||
# Ray tests run out of memory on Windows
|
||||
- os: windows-latest
|
||||
kind: ray
|
||||
# Ray doesn't currently support Python 3.12
|
||||
- python-version: '3.12'
|
||||
kind: ray
|
||||
# Assign the correct package and testing options for each kind of test
|
||||
include:
|
||||
- kind: serial
|
||||
|
|
|
@ -36,8 +36,8 @@ class DoWhyWrapper:
|
|||
"""
|
||||
|
||||
def __init__(self, cate_estimator):
|
||||
from pkg_resources import parse_version
|
||||
if parse_version(dowhy.__version__) >= parse_version('0.11'):
|
||||
from packaging.version import parse
|
||||
if parse(dowhy.__version__) >= parse('0.11'):
|
||||
warnings.warn("econml has not been tested with dowhy versions >= 0.11")
|
||||
self._cate_estimator = cate_estimator
|
||||
|
||||
|
|
|
@ -825,9 +825,9 @@ def _cross_val_predict(estimator, X, y=None, *, groups=None, cv=None,
|
|||
parallel = Parallel(n_jobs=n_jobs, verbose=verbose,
|
||||
pre_dispatch=pre_dispatch)
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from packaging.version import parse
|
||||
# verbose was removed from sklearn's non-public _fit_and_predict method in 1.4
|
||||
if parse_version(sklearn.__version__) < parse_version("1.4"):
|
||||
if parse(sklearn.__version__) < parse("1.4"):
|
||||
predictions = parallel(delayed(_fit_and_predict)(
|
||||
clone(estimator, safe=safe), X, y, train, test, verbose, fit_params, method)
|
||||
for train, test in splits)
|
||||
|
|
|
@ -787,7 +787,7 @@ class TestDML(unittest.TestCase):
|
|||
np.testing.assert_array_less(mean_truth - .03, inf_sum.ci_upper)
|
||||
tables = est.summary().tables
|
||||
for t in range(4):
|
||||
np.testing.assert_allclose(np.array(tables[t].data[1:])[:, 1].astype(np.float),
|
||||
np.testing.assert_allclose(np.array(tables[t].data[1:])[:, 1].astype(float),
|
||||
mean_truth, rtol=0, atol=.06)
|
||||
|
||||
if it == 0:
|
||||
|
|
|
@ -316,8 +316,8 @@ class TestOrthoForest(unittest.TestCase):
|
|||
"Estimators of type {} do not accept weights. "
|
||||
"Consider using the class WeightedModelWrapper from econml.utilities to build a weighted model."
|
||||
)
|
||||
self.assertRaisesRegexp(TypeError, weights_error_msg.format("NoWeightModel"),
|
||||
est.effect, X=TestOrthoForest.X)
|
||||
self.assertRaisesRegex(TypeError, weights_error_msg.format("NoWeightModel"),
|
||||
est.effect, X=TestOrthoForest.X)
|
||||
|
||||
def _test_te(self, learner_instance, expected_te, tol, treatment_type='continuous'):
|
||||
# Compute the treatment effect on test points
|
||||
|
|
|
@ -1516,8 +1516,8 @@ def one_hot_encoder(sparse=False, **kwargs):
|
|||
Wrapper for sklearn's OneHotEncoder that handles the name change from `sparse` to `sparse_output`
|
||||
between sklearn versions 1.1 and 1.2.
|
||||
"""
|
||||
from pkg_resources import parse_version
|
||||
if parse_version(sklearn.__version__) < parse_version("1.2"):
|
||||
from packaging.version import parse
|
||||
if parse(sklearn.__version__) < parse("1.2"):
|
||||
return OneHotEncoder(sparse=sparse, **kwargs)
|
||||
else:
|
||||
return OneHotEncoder(sparse_output=sparse, **kwargs)
|
||||
|
|
|
@ -28,7 +28,8 @@ dependencies = [
|
|||
"statsmodels >= 0.10",
|
||||
"pandas > 1.0",
|
||||
"shap >= 0.38.1, < 0.44.0",
|
||||
"lightgbm"
|
||||
"lightgbm",
|
||||
"packaging"
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
|
Загрузка…
Ссылка в новой задаче