Skip to content

Commit 8532425

Browse files
ogriselArturoAmorQ
andcommitted
[ci skip] Feature branch to update to 1.6 (#813)
* Feature branch to update to 1.6 * MNT Fix several FutureWarnings (#810) * MTN Wrap up quiz sklearn 1.6 verification (#817) * MAINT Use class_of_interest in DecisionBoundaryDisplay (#772) * Resync everything --------- Co-authored-by: Arturo Amor <[email protected]> Co-authored-by: SebastienMelo <[email protected]> c9728c8
1 parent 9b1811d commit 8532425

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+383
-555
lines changed
Loading
Binary file not shown.

_sources/python_scripts/01_tabular_data_exploration_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/02_numerical_pipeline_ex_00.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/02_numerical_pipeline_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/03_categorical_pipeline_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/03_categorical_pipeline_ex_02.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3
@@ -112,26 +112,7 @@
112112
# Write your code here.
113113

114114
# %% [markdown]
115-
# ### Analysis
116-
#
117-
# From an accuracy point of view, the result is almost exactly the same. The
118-
# reason is that `HistGradientBoostingClassifier` is expressive and robust
119-
# enough to deal with misleading ordering of integer coded categories (which was
120-
# not the case for linear models).
121-
#
122-
# However from a computation point of view, the training time is much longer:
123-
# this is caused by the fact that `OneHotEncoder` generates more features than
124-
# `OrdinalEncoder`; for each unique categorical value a column is created.
125-
#
126-
# Note that the current implementation `HistGradientBoostingClassifier` is still
127-
# incomplete, and once sparse representation are handled correctly, training
128-
# time might improve with such kinds of encodings.
129-
#
130-
# The main take away message is that arbitrary integer coding of categories is
131-
# perfectly fine for `HistGradientBoostingClassifier` and yields fast training
132-
# times.
133-
134-
# Which encoder should I use?
115+
# ## Which encoder should I use?
135116
#
136117
# | | Meaningful order | Non-meaningful order |
137118
# | ---------------- | ----------------------------- | -------------------- |

_sources/python_scripts/cross_validation_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/cross_validation_ex_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/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

_sources/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

_sources/python_scripts/ensemble_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/ensemble_ex_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/ensemble_ex_03.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3
@@ -70,6 +70,13 @@
7070
# ensemble. However, the scores reach a plateau where adding new trees just
7171
# makes fitting and scoring slower.
7272
#
73+
# Now repeat the analysis for the gradient boosting model.
74+
75+
# %%
76+
# Write your code here.
77+
78+
79+
# %% [markdown]
7380
# Gradient boosting models overfit when the number of trees is too large. To
7481
# avoid adding a new unnecessary tree, unlike random-forest gradient-boosting
7582
# offers an early-stopping option. Internally, the algorithm uses an
@@ -78,9 +85,9 @@
7885
# improving for several iterations, it stops adding trees.
7986
#
8087
# Now, create a gradient-boosting model with `n_estimators=1_000`. This number
81-
# of trees is certainly too large. Change the parameter `n_iter_no_change`
82-
# such that the gradient boosting fitting stops after adding 5 trees to avoid
83-
# deterioration of the overall generalization performance.
88+
# of trees is certainly too large as we have seen above. Change the parameter
89+
# `n_iter_no_change` such that the gradient boosting fitting stops after adding
90+
# 5 trees to avoid deterioration of the overall generalization performance.
8491

8592
# %%
8693
# Write your code here.

_sources/python_scripts/ensemble_ex_04.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/feature_selection_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/linear_models_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/linear_models_ex_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/linear_models_ex_03.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/linear_models_ex_04.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/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

_sources/python_scripts/metrics_ex_01.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/metrics_ex_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/parameter_tuning_ex_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/python_scripts/parameter_tuning_ex_03.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

_sources/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]

_sources/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
# %%

_sources/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
# %%

_sources/python_scripts/trees_ex_01.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3
@@ -59,9 +59,9 @@
5959
#
6060
# ```{warning}
6161
# At this time, it is not possible to use `response_method="predict_proba"` for
62-
# multiclass problems. This is a planned feature for a future version of
63-
# scikit-learn. In the mean time, you can use `response_method="predict"`
64-
# instead.
62+
# multiclass problems on a single plot. This is a planned feature for a future
63+
# version of scikit-learn. In the mean time, you can use
64+
# `response_method="predict"` instead.
6565
# ```
6666

6767
# %%

_sources/python_scripts/trees_ex_02.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# extension: .py
66
# format_name: percent
77
# format_version: '1.3'
8-
# jupytext_version: 1.16.7
8+
# jupytext_version: 1.17.1
99
# kernelspec:
1010
# display_name: Python 3
1111
# name: python3

0 commit comments

Comments
 (0)