From 3e8036307d7a2b60c0b416820f39cfc96acba748 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Tue, 21 Feb 2017 13:45:56 -0800 Subject: [PATCH 1/2] FIX lasso/elasticnet example did not add noise to simulated data. The first argument of np.random.normal is the mean of the distribution, and not the output shape. The example thus did not add noise but only an intercept to the model. --- examples/linear_model/plot_lasso_and_elasticnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/linear_model/plot_lasso_and_elasticnet.py b/examples/linear_model/plot_lasso_and_elasticnet.py index d59ae02a4ae7d..747f238a3fd13 100644 --- a/examples/linear_model/plot_lasso_and_elasticnet.py +++ b/examples/linear_model/plot_lasso_and_elasticnet.py @@ -28,7 +28,7 @@ y = np.dot(X, coef) # add noise -y += 0.01 * np.random.normal((n_samples,)) +y += 0.01 * np.random.normal(size=(n_samples,)) # Split data in train set and test set n_samples = X.shape[0] From 1d839cceca62ed7551563a8340c75ed0f40ba618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 22 Feb 2017 14:17:03 +0100 Subject: [PATCH 2/2] No need to pass tuple to size --- examples/linear_model/plot_lasso_and_elasticnet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/linear_model/plot_lasso_and_elasticnet.py b/examples/linear_model/plot_lasso_and_elasticnet.py index 747f238a3fd13..ca2d2425f9f5d 100644 --- a/examples/linear_model/plot_lasso_and_elasticnet.py +++ b/examples/linear_model/plot_lasso_and_elasticnet.py @@ -28,7 +28,7 @@ y = np.dot(X, coef) # add noise -y += 0.01 * np.random.normal(size=(n_samples,)) +y += 0.01 * np.random.normal(size=n_samples) # Split data in train set and test set n_samples = X.shape[0]