From 2e2dabe3d89c286ded6345b5f709f5d3f46498e7 Mon Sep 17 00:00:00 2001 From: Maxim Darii Date: Tue, 28 Mar 2023 20:42:16 +0200 Subject: [PATCH 1/3] Add randomness to HistGradientBoostingRegressor in plot_cyclical_feature_engineering.py --- examples/applications/plot_cyclical_feature_engineering.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/applications/plot_cyclical_feature_engineering.py b/examples/applications/plot_cyclical_feature_engineering.py index b2d33de149d39..ecd270354ab76 100644 --- a/examples/applications/plot_cyclical_feature_engineering.py +++ b/examples/applications/plot_cyclical_feature_engineering.py @@ -216,6 +216,7 @@ ), HistGradientBoostingRegressor( categorical_features=categorical_columns, + random_state=42, ), ).set_output(transform="pandas") From ec0c2d56410f184c6dc0bc83652baf8a1b324887 Mon Sep 17 00:00:00 2001 From: Maxim Darii Date: Tue, 28 Mar 2023 20:55:19 +0200 Subject: [PATCH 2/3] Add randomness to PCA and KernelPCA in plot_digits_denoising.py --- examples/applications/plot_digits_denoising.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/applications/plot_digits_denoising.py b/examples/applications/plot_digits_denoising.py index 84702034152f5..6e17e491b016e 100644 --- a/examples/applications/plot_digits_denoising.py +++ b/examples/applications/plot_digits_denoising.py @@ -98,9 +98,9 @@ def plot_digits(X, title): # uses a radial basis function (RBF) kernel. from sklearn.decomposition import PCA, KernelPCA -pca = PCA(n_components=32) +pca = PCA(n_components=32, random_state=42) kernel_pca = KernelPCA( - n_components=400, kernel="rbf", gamma=1e-3, fit_inverse_transform=True, alpha=5e-3 + n_components=400, kernel="rbf", gamma=1e-3, fit_inverse_transform=True, alpha=5e-3, random_state=42 ) pca.fit(X_train_noisy) From 12498236100575c2dfd5bdc4bce4b858a8a93378 Mon Sep 17 00:00:00 2001 From: Maxim Darii Date: Tue, 28 Mar 2023 21:09:58 +0200 Subject: [PATCH 3/3] Fixed linting error --- examples/applications/plot_digits_denoising.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/applications/plot_digits_denoising.py b/examples/applications/plot_digits_denoising.py index 6e17e491b016e..cec8e342367c3 100644 --- a/examples/applications/plot_digits_denoising.py +++ b/examples/applications/plot_digits_denoising.py @@ -100,7 +100,12 @@ def plot_digits(X, title): pca = PCA(n_components=32, random_state=42) kernel_pca = KernelPCA( - n_components=400, kernel="rbf", gamma=1e-3, fit_inverse_transform=True, alpha=5e-3, random_state=42 + n_components=400, + kernel="rbf", + gamma=1e-3, + fit_inverse_transform=True, + alpha=5e-3, + random_state=42, ) pca.fit(X_train_noisy)