Skip to content

Commit cf8f7fb

Browse files
add future warnings on breaking changes in 3.0.0
1 parent 461de0f commit cf8f7fb

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Unreleased
1919
- Require Python>=3.9 in line with `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table>`_
2020
- Build and test with Python 3.12 in CI.
2121
- Added line search stopping criterion for tiny loss improvements based on gradient information.
22+
- Added warnings about breaking changes in future versions.
2223

2324
2.6.0 - 2023-09-05
2425
------------------

src/glum/_glm.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,11 @@ def __init__(
727727
robust: bool = True,
728728
expected_information: bool = False,
729729
):
730+
warnings.warn(
731+
"Arguments to :class:`GeneralizedLinearRegressorBase`, :class:`GeneralizedLinearRegressor` ",
732+
"and :class:`GeneralizedLinearRegressorCV` will become keyword-only in 3.0.0.",
733+
FutureWarning,
734+
)
730735
self.l1_ratio = l1_ratio
731736
self.P1 = P1
732737
self.P2 = P2
@@ -1133,6 +1138,10 @@ def report_diagnostics(
11331138
custom_columns : iterable, optional (default=None)
11341139
Print only the specified columns.
11351140
"""
1141+
warnings.warn(
1142+
"Arguments to `report_diagnostics` will become keyword-only in 3.0.0.",
1143+
FutureWarning,
1144+
)
11361145
diagnostics = self.get_formatted_diagnostics(full_report, custom_columns)
11371146
if isinstance(diagnostics, str):
11381147
print(diagnostics)
@@ -1159,6 +1168,10 @@ def get_formatted_diagnostics(
11591168
custom_columns : iterable, optional (default=None)
11601169
Print only the specified columns.
11611170
"""
1171+
warnings.warn(
1172+
"Arguments to `get_formatted_diagnostics` will become keyword-only in 3.0.0.",
1173+
FutureWarning,
1174+
)
11621175
if not hasattr(self, "diagnostics_"):
11631176
to_print = "Model has not been fit, so no diagnostics exist."
11641177
return to_print
@@ -1236,6 +1249,10 @@ def linear_predictor(
12361249
array, shape (n_samples, n_alphas)
12371250
The linear predictor.
12381251
"""
1252+
warnings.warn(
1253+
"Arguments to `linear_predictor` other than `X` and `offset` will become keyword-only in 3.0.0.",
1254+
FutureWarning,
1255+
)
12391256
check_is_fitted(self, "coef_")
12401257

12411258
if (alpha is not None) and (alpha_index is not None):
@@ -1315,6 +1332,10 @@ def predict(
13151332
array, shape (n_samples, n_alphas)
13161333
Predicted values times ``sample_weight``.
13171334
"""
1335+
warnings.warn(
1336+
"Arguments to `predict` other than `X`, ``sample_weight`, and `offset` will become keyword-only in 3.0.0.",
1337+
FutureWarning,
1338+
)
13181339
if isinstance(X, pd.DataFrame) and hasattr(self, "feature_dtypes_"):
13191340
X = _align_df_categories(X, self.feature_dtypes_)
13201341

@@ -1390,6 +1411,11 @@ def coef_table(
13901411
pandas.DataFrame
13911412
A table of the regression results.
13921413
"""
1414+
warnings.warn(
1415+
"Arguments to `coef_table` other than `X`, `y`, `sample_weight`, and `offset` "
1416+
"will become keyword-only in 3.0.0.",
1417+
FutureWarning,
1418+
)
13931419
if self.fit_intercept:
13941420
names = ["intercept"] + list(self.feature_names_)
13951421
beta = np.concatenate([[self.intercept_], self.coef_])
@@ -1498,6 +1524,11 @@ def wald_test(
14981524
WaldTestResult
14991525
NamedTuple with test statistic, p-value, and degrees of freedom.
15001526
"""
1527+
warnings.warn(
1528+
"Arguments to `coef_table` other than `X`, `y`, `sample_weight`, and `offset` "
1529+
"will become keyword-only in 3.0.0.",
1530+
FutureWarning,
1531+
)
15011532

15021533
num_lhs_specs = sum([R is not None, features is not None])
15031534
if num_lhs_specs != 1:
@@ -1890,6 +1921,11 @@ def covariance_matrix(
18901921
Cambridge university press
18911922
18921923
"""
1924+
warnings.warn(
1925+
"Arguments to `covaria ce_matrix` other than `X`, `y`, `sample_weight`, and `offset` "
1926+
"will become keyword-only in 3.0.0.",
1927+
FutureWarning,
1928+
)
18931929
self.covariance_matrix_: Union[np.ndarray, None]
18941930

18951931
if robust is None:
@@ -2763,6 +2799,9 @@ def __init__(
27632799
robust: bool = True,
27642800
expected_information: bool = False,
27652801
):
2802+
warnings.warn(
2803+
"The default value of `alpha` will become `0` in 3.0.0.", FutureWarning
2804+
)
27662805
self.alphas = alphas
27672806
self.alpha = alpha
27682807
super().__init__(
@@ -2895,6 +2934,11 @@ def fit(
28952934
-------
28962935
self
28972936
"""
2937+
warnings.warn(
2938+
"Arguments to `fit` other than `X`, `y`, `sample_weight`, and `offset` "
2939+
"will become keyword-only in 3.0.0.",
2940+
FutureWarning,
2941+
)
28982942

28992943
self._validate_hyperparameters()
29002944

0 commit comments

Comments
 (0)