1818import numpy as np
1919from joblib import Parallel , delayed
2020from ...utils ._scikit import (
21- _BaseEstimator ,
22- _ClassifierMixin ,
23- _RegressorMixin ,
24- _NotFittedError ,
21+ SKBaseEstimator ,
22+ SKClassifierMixin ,
23+ SKRegressorMixin ,
24+ SKNotFittedError ,
2525 _is_classifier ,
2626 _is_regressor ,
2727)
@@ -283,7 +283,7 @@ def clean_interactions(interactions, n_features_in):
283283 return interactions
284284
285285
286- class BaseEBM (LocalExplainer , GlobalExplainer , _BaseEstimator ):
286+ class BaseEBM (LocalExplainer , GlobalExplainer , SKBaseEstimator ):
287287 """Base class for all EBMs. Do not instantiate directly."""
288288
289289 n_features_in_ : int
@@ -1713,7 +1713,7 @@ def to_jsonable(self, detail="all"):
17131713
17141714 """
17151715 if not hasattr (self , "bins_" ):
1716- raise _NotFittedError (
1716+ raise SKNotFittedError (
17171717 "This model has not been fitted yet. Call 'fit' first."
17181718 )
17191719
@@ -1735,7 +1735,7 @@ def to_json(self, file, detail="all", indent=2):
17351735
17361736 """
17371737 if not hasattr (self , "bins_" ):
1738- raise _NotFittedError (
1738+ raise SKNotFittedError (
17391739 "This model has not been fitted yet. Call 'fit' first."
17401740 )
17411741
@@ -1796,7 +1796,7 @@ def to_excel_exportable(self, file):
17961796 """
17971797
17981798 if not hasattr (self , "bins_" ):
1799- raise _NotFittedError (
1799+ raise SKNotFittedError (
18001800 "This model has not been fitted yet. Call 'fit' first."
18011801 )
18021802
@@ -1817,7 +1817,7 @@ def to_excel(self, file):
18171817 """
18181818
18191819 if not hasattr (self , "bins_" ):
1820- raise _NotFittedError (
1820+ raise SKNotFittedError (
18211821 "This model has not been fitted yet. Call 'fit' first."
18221822 )
18231823
@@ -1837,7 +1837,7 @@ def _predict_score(self, X, init_score=None):
18371837
18381838 """
18391839 if not hasattr (self , "bins_" ):
1840- raise _NotFittedError (
1840+ raise SKNotFittedError (
18411841 "This model has not been fitted yet. Call 'fit' first."
18421842 )
18431843
@@ -1872,7 +1872,7 @@ def eval_terms(self, X):
18721872
18731873 """
18741874 if not hasattr (self , "bins_" ):
1875- raise _NotFittedError (
1875+ raise SKNotFittedError (
18761876 "This model has not been fitted yet. Call 'fit' first."
18771877 )
18781878
@@ -1901,7 +1901,7 @@ def explain_global(self, name=None):
19011901 name = gen_name_from_class (self )
19021902
19031903 if not hasattr (self , "bins_" ):
1904- raise _NotFittedError (
1904+ raise SKNotFittedError (
19051905 "This model has not been fitted yet. Call 'fit' first."
19061906 )
19071907
@@ -2187,7 +2187,7 @@ def explain_local(self, X, y=None, name=None, init_score=None):
21872187 # Values are the model graph score per respective term.
21882188
21892189 if not hasattr (self , "bins_" ):
2190- raise _NotFittedError (
2190+ raise SKNotFittedError (
21912191 "This model has not been fitted yet. Call 'fit' first."
21922192 )
21932193
@@ -2329,7 +2329,7 @@ def term_importances(self, importance_type="avg_weight"):
23292329
23302330 """
23312331 if not hasattr (self , "bins_" ):
2332- raise _NotFittedError (
2332+ raise SKNotFittedError (
23332333 "This model has not been fitted yet. Call 'fit' first."
23342334 )
23352335
@@ -2385,7 +2385,7 @@ def monotonize(self, term, increasing="auto", passthrough=0.0):
23852385
23862386 """
23872387 if not hasattr (self , "bins_" ):
2388- raise _NotFittedError (
2388+ raise SKNotFittedError (
23892389 "This model has not been fitted yet. Call 'fit' first."
23902390 )
23912391
@@ -2486,7 +2486,7 @@ def remove_terms(self, terms):
24862486
24872487 """
24882488 if not hasattr (self , "bins_" ):
2489- raise _NotFittedError (
2489+ raise SKNotFittedError (
24902490 "This model has not been fitted yet. Call 'fit' first."
24912491 )
24922492
@@ -2540,7 +2540,7 @@ def remove_features(self, features):
25402540
25412541 """
25422542 if not hasattr (self , "bins_" ):
2543- raise _NotFittedError (
2543+ raise SKNotFittedError (
25442544 "This model has not been fitted yet. Call 'fit' first."
25452545 )
25462546
@@ -2597,7 +2597,7 @@ def sweep(self, terms=True, bins=True, features=False):
25972597
25982598 """
25992599 if not hasattr (self , "bins_" ):
2600- raise _NotFittedError (
2600+ raise SKNotFittedError (
26012601 "This model has not been fitted yet. Call 'fit' first."
26022602 )
26032603
@@ -2652,7 +2652,7 @@ def scale(self, term, factor):
26522652
26532653 """
26542654 if not hasattr (self , "bins_" ):
2655- raise _NotFittedError (
2655+ raise SKNotFittedError (
26562656 "This model has not been fitted yet. Call 'fit' first."
26572657 )
26582658
@@ -2688,7 +2688,7 @@ def predict_with_uncertainty(self, X, init_score=None):
26882688 """
26892689
26902690 if not hasattr (self , "bins_" ):
2691- raise _NotFittedError (
2691+ raise SKNotFittedError (
26922692 "This model has not been fitted yet. Call 'fit' first."
26932693 )
26942694
@@ -2723,7 +2723,7 @@ def predict_with_uncertainty(self, X, init_score=None):
27232723
27242724 def _multinomialize (self , passthrough = 0.0 ):
27252725 if not hasattr (self , "bins_" ):
2726- raise _NotFittedError (
2726+ raise SKNotFittedError (
27272727 "This model has not been fitted yet. Call 'fit' first."
27282728 )
27292729
@@ -2776,7 +2776,7 @@ def _multinomialize(self, passthrough=0.0):
27762776
27772777 def _ovrize (self , passthrough = 0.0 ):
27782778 if not hasattr (self , "bins_" ):
2779- raise _NotFittedError (
2779+ raise SKNotFittedError (
27802780 "This model has not been fitted yet. Call 'fit' first."
27812781 )
27822782
@@ -2829,7 +2829,7 @@ def _ovrize(self, passthrough=0.0):
28292829
28302830 def _binarize (self , passthrough = 0.0 ):
28312831 if not hasattr (self , "bins_" ):
2832- raise _NotFittedError (
2832+ raise SKNotFittedError (
28332833 "This model has not been fitted yet. Call 'fit' first."
28342834 )
28352835
@@ -2878,7 +2878,7 @@ def __sklearn_tags__(self):
28782878 return tags
28792879
28802880
2881- class EBMClassifierMixin (_ClassifierMixin ):
2881+ class EBMClassifierMixin (SKClassifierMixin ):
28822882 """Mixin class for EBM classifiers.
28832883
28842884 Provides predict, predict_proba, decision_function, and reorder_classes methods.
@@ -2902,7 +2902,7 @@ def predict_proba(self, X, init_score=None):
29022902 """
29032903
29042904 if not hasattr (self , "bins_" ):
2905- raise _NotFittedError (
2905+ raise SKNotFittedError (
29062906 "This model has not been fitted yet. Call 'fit' first."
29072907 )
29082908
@@ -2940,7 +2940,7 @@ def decision_function(self, X, init_score=None):
29402940
29412941 """
29422942 if not hasattr (self , "bins_" ):
2943- raise _NotFittedError (
2943+ raise SKNotFittedError (
29442944 "This model has not been fitted yet. Call 'fit' first."
29452945 )
29462946
@@ -2974,7 +2974,7 @@ def predict(self, X, init_score=None):
29742974
29752975 """
29762976 if not hasattr (self , "bins_" ):
2977- raise _NotFittedError (
2977+ raise SKNotFittedError (
29782978 "This model has not been fitted yet. Call 'fit' first."
29792979 )
29802980
@@ -3013,7 +3013,7 @@ def reorder_classes(self, classes):
30133013
30143014 """
30153015 if not hasattr (self , "bins_" ):
3016- raise _NotFittedError (
3016+ raise SKNotFittedError (
30173017 "This model has not been fitted yet. Call 'fit' first."
30183018 )
30193019
@@ -3063,7 +3063,7 @@ def reorder_classes(self, classes):
30633063 return self
30643064
30653065
3066- class EBMRegressorMixin (_RegressorMixin ):
3066+ class EBMRegressorMixin (SKRegressorMixin ):
30673067 """Mixin class for EBM regressors.
30683068
30693069 Provides the regression predict method.
@@ -3088,7 +3088,7 @@ def predict(self, X, init_score=None):
30883088 """
30893089
30903090 if not hasattr (self , "bins_" ):
3091- raise _NotFittedError (
3091+ raise SKNotFittedError (
30923092 "This model has not been fitted yet. Call 'fit' first."
30933093 )
30943094
0 commit comments