Skip to content

Commit

Permalink
Enable support for scikit-learn 1.5
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Battocchi <[email protected]>
  • Loading branch information
kbattocchi committed Jul 3, 2024
1 parent 5894804 commit 784a8d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion econml/_ensemble/_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
import numpy as np
from abc import ABCMeta, abstractmethod
from sklearn.base import BaseEstimator, clone
from sklearn.utils import _print_elapsed_time
from sklearn.utils import check_random_state
from joblib import effective_n_jobs
from packaging.version import parse
import sklearn
if parse(sklearn.__version__) < parse("1.5"):
from sklearn.utils import _print_elapsed_time
else:
from sklearn.utils._user_interface import _print_elapsed_time


def _fit_single_estimator(estimator, X, y, sample_weight=None,
Expand Down
7 changes: 6 additions & 1 deletion econml/solutions/causal_analysis/_causal_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
# TODO: this utility is documented but internal; reimplement?
from sklearn.utils import _safe_indexing
# TODO: this utility is even less public...
from sklearn.utils import _get_column_indices
from packaging.version import parse
import sklearn
if parse(sklearn.__version__) < parse("1.5"):
from sklearn.utils import _get_column_indices
else:
from sklearn.utils._indexing import _get_column_indices


class _CausalInsightsConstants:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
dependencies = [
"numpy",
"scipy > 1.4.0",
"scikit-learn >= 1.0, < 1.5",
"scikit-learn >= 1.0, < 1.6",
"sparse",
"joblib >= 0.13.0",
"statsmodels >= 0.10",
Expand Down

0 comments on commit 784a8d4

Please sign in to comment.