From cc13c24e6401054adcc401bf60331a8c1d10e343 Mon Sep 17 00:00:00 2001 From: rishikksh20 Date: Wed, 1 Feb 2017 12:44:41 +0530 Subject: [PATCH] Update rigde path example Change the name of ridge object clf to ridge and also reinstantiate ridge in every iteration. Issue: https://github.com/scikit-learn/scikit-learn/issues/8256 --- examples/linear_model/plot_ridge_path.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/linear_model/plot_ridge_path.py b/examples/linear_model/plot_ridge_path.py index 52f816d342276..1f2c475f78b7d 100644 --- a/examples/linear_model/plot_ridge_path.py +++ b/examples/linear_model/plot_ridge_path.py @@ -44,13 +44,12 @@ n_alphas = 200 alphas = np.logspace(-10, -2, n_alphas) -clf = linear_model.Ridge(fit_intercept=False) coefs = [] for a in alphas: - clf.set_params(alpha=a) - clf.fit(X, y) - coefs.append(clf.coef_) + ridge = linear_model.Ridge(alpha=a, fit_intercept=False) + ridge.fit(X, y) + coefs.append(ridge.coef_) ############################################################################### # Display results