Skip to content

Commit 3ce9aaa

Browse files
committed
kde support is removed due to scipy.stats.kde deprecation in distfit.
1 parent 92ce29a commit 3ce9aaa

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

skpro/regression/unconditional_distfit.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class UnconditionalDistfitRegressor(BaseProbaRegressor):
4949
}
5050

5151
def __init__(
52-
self, distr_type="norm", random_state=None, fit_kde=True, fit_histogram=False
52+
self, distr_type="norm", random_state=None, fit_histogram=False
5353
):
5454
"""
5555
Initialize UnconditionalDistfitRegressor.
@@ -61,14 +61,11 @@ def __init__(
6161
distfit docs for full list).
6262
random_state : int or None
6363
Random seed for reproducibility.
64-
fit_kde : bool, default=True
65-
If True, fit a KDE (kernel density estimate) using distfit's kde option.
6664
fit_histogram : bool, default=False
6765
If True, fit a histogram using distfit's histogram option.
6866
"""
6967
self.distr_type = distr_type
7068
self.random_state = random_state
71-
self.fit_kde = fit_kde
7269
self.fit_histogram = fit_histogram
7370
super().__init__()
7471

@@ -77,11 +74,11 @@ def _fit(self, X, y, C=None):
7774
from distfit import distfit
7875

7976
y_arr = y.values.flatten() if hasattr(y, "values") else np.asarray(y).flatten()
80-
# Block KDE usage due to scipy.stats.kde deprecation in distfit
81-
if self.fit_kde or self.distr_type == "kde":
77+
# KDE support removed due to scipy.stats.kde deprecation in distfit
78+
if self.distr_type == "kde":
8279
raise RuntimeError(
83-
"distfit KDE support broken due to scipy.stats.kde removal. "
84-
"Please use a different distribution type or set fit_kde=False."
80+
"KDE support is removed due to scipy.stats.kde deprecation in distfit. "
81+
"Please use a different distribution type."
8582
)
8683
if self.fit_histogram:
8784
self.distfit_ = distfit(distr="histogram", random_state=self.random_state)
@@ -100,8 +97,8 @@ def _predict_proba(self, X):
10097
def get_test_params(cls, parameter_set="default"):
10198
"""Return testing parameter sets for automated tests."""
10299
return [
103-
{"distr_type": "norm", "fit_kde": False, "fit_histogram": False},
104-
{"distr_type": "laplace", "fit_kde": True, "fit_histogram": False},
100+
{"distr_type": "norm", "fit_histogram": False},
101+
{"distr_type": "laplace", "fit_histogram": False},
105102
]
106103

107104

0 commit comments

Comments
 (0)