Skip to content

Commit a1f0aef

Browse files
authored
MNT Fix several FutureWarnings (#810)
1 parent 5275b57 commit a1f0aef

11 files changed

+17
-10
lines changed

notebooks/datasets_bike_rides.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"metadata": {},
272272
"outputs": [],
273273
"source": [
274-
"data_ride.resample(\"60S\").mean().plot()\n",
274+
"data_ride.resample(\"60s\").mean().plot()\n",
275275
"plt.legend(bbox_to_anchor=(1.05, 1), loc=\"upper left\")\n",
276276
"_ = plt.title(\"Sensor values for different cyclist measurements\")"
277277
]

notebooks/ensemble_adaboost.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
"\n",
272272
"estimator = DecisionTreeClassifier(max_depth=3, random_state=0)\n",
273273
"adaboost = AdaBoostClassifier(\n",
274-
" estimator=estimator, n_estimators=3, algorithm=\"SAMME\", random_state=0\n",
274+
" estimator=estimator, n_estimators=3, random_state=0\n",
275275
")\n",
276276
"adaboost.fit(data, target)"
277277
]

notebooks/linear_models_regularization.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@
618618
"ridge = make_pipeline(\n",
619619
" MinMaxScaler(),\n",
620620
" PolynomialFeatures(degree=2, include_bias=False),\n",
621-
" RidgeCV(alphas=alphas, store_cv_values=True),\n",
621+
" RidgeCV(alphas=alphas, store_cv_results=True),\n",
622622
")"
623623
]
624624
},
@@ -677,7 +677,7 @@
677677
"It indicates that our model is not overfitting.\n",
678678
"\n",
679679
"When fitting the ridge regressor, we also requested to store the error found\n",
680-
"during cross-validation (by setting the parameter `store_cv_values=True`). We\n",
680+
"during cross-validation (by setting the parameter `store_cv_results=True`). We\n",
681681
"can plot the mean squared error for the different `alphas` regularization\n",
682682
"strengths that we tried. The error bars represent one standard deviation of the\n",
683683
"average mean square error across folds for a given value of `alpha`."
@@ -690,7 +690,7 @@
690690
"outputs": [],
691691
"source": [
692692
"mse_alphas = [\n",
693-
" est[-1].cv_values_.mean(axis=0) for est in cv_results[\"estimator\"]\n",
693+
" est[-1].cv_results_.mean(axis=0) for est in cv_results[\"estimator\"]\n",
694694
"]\n",
695695
"cv_alphas = pd.DataFrame(mse_alphas, columns=alphas)\n",
696696
"cv_alphas = cv_alphas.aggregate([\"mean\", \"std\"]).T\n",

notebooks/parameter_tuning_nested.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
" (\"cat_preprocessor\", categorical_preprocessor, categorical_columns),\n",
7171
" ],\n",
7272
" remainder=\"passthrough\",\n",
73+
" force_int_remainder_cols=False, # Silence a warning in scikit-learn v1.6.\n",
7374
")"
7475
]
7576
},

notebooks/parameter_tuning_randomized_search.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
"preprocessor = ColumnTransformer(\n",
122122
" [(\"cat_preprocessor\", categorical_preprocessor, categorical_columns)],\n",
123123
" remainder=\"passthrough\",\n",
124+
" force_int_remainder_cols=False, # Silence a warning in scikit-learn v1.6.\n",
124125
")"
125126
]
126127
},

python_scripts/datasets_bike_rides.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
# smoother visualization.
156156

157157
# %%
158-
data_ride.resample("60S").mean().plot()
158+
data_ride.resample("60s").mean().plot()
159159
plt.legend(bbox_to_anchor=(1.05, 1), loc="upper left")
160160
_ = plt.title("Sensor values for different cyclist measurements")
161161

python_scripts/ensemble_adaboost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190

191191
estimator = DecisionTreeClassifier(max_depth=3, random_state=0)
192192
adaboost = AdaBoostClassifier(
193-
estimator=estimator, n_estimators=3, algorithm="SAMME", random_state=0
193+
estimator=estimator, n_estimators=3, random_state=0
194194
)
195195
adaboost.fit(data, target)
196196

python_scripts/linear_models_regularization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@
421421
ridge = make_pipeline(
422422
MinMaxScaler(),
423423
PolynomialFeatures(degree=2, include_bias=False),
424-
RidgeCV(alphas=alphas, store_cv_values=True),
424+
RidgeCV(alphas=alphas, store_cv_results=True),
425425
)
426426

427427
# %%
@@ -458,14 +458,14 @@
458458
# It indicates that our model is not overfitting.
459459
#
460460
# When fitting the ridge regressor, we also requested to store the error found
461-
# during cross-validation (by setting the parameter `store_cv_values=True`). We
461+
# during cross-validation (by setting the parameter `store_cv_results=True`). We
462462
# can plot the mean squared error for the different `alphas` regularization
463463
# strengths that we tried. The error bars represent one standard deviation of the
464464
# average mean square error across folds for a given value of `alpha`.
465465

466466
# %%
467467
mse_alphas = [
468-
est[-1].cv_values_.mean(axis=0) for est in cv_results["estimator"]
468+
est[-1].cv_results_.mean(axis=0) for est in cv_results["estimator"]
469469
]
470470
cv_alphas = pd.DataFrame(mse_alphas, columns=alphas)
471471
cv_alphas = cv_alphas.aggregate(["mean", "std"]).T

python_scripts/parameter_tuning_grid_search.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
preprocessor = ColumnTransformer(
9090
[("cat_preprocessor", categorical_preprocessor, categorical_columns)],
9191
remainder="passthrough",
92+
# Silence a deprecation warning in scikit-learn v1.6 related to how the
93+
# ColumnTransformer stores an attribute that we do not use in this notebook
94+
force_int_remainder_cols=False,
9295
)
9396

9497
# %% [markdown]

python_scripts/parameter_tuning_nested.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
("cat_preprocessor", categorical_preprocessor, categorical_columns),
5757
],
5858
remainder="passthrough",
59+
force_int_remainder_cols=False, # Silence a warning in scikit-learn v1.6.
5960
)
6061

6162
# %%

python_scripts/parameter_tuning_randomized_search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
preprocessor = ColumnTransformer(
7474
[("cat_preprocessor", categorical_preprocessor, categorical_columns)],
7575
remainder="passthrough",
76+
force_int_remainder_cols=False, # Silence a warning in scikit-learn v1.6.
7677
)
7778

7879
# %%

0 commit comments

Comments
 (0)