10000 [MRG] FIX lasso/elasticnet example did not add noise to simulated dat… · maskani-moh/scikit-learn@3ecb912 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ecb912

Browse files
NelleVmaskani-moh
authored andcommitted
[MRG] FIX lasso/elasticnet example did not add noise to simulated data. (scikit-learn#8427)
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.
1 parent 3c1a3a7 commit 3ecb912

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/linear_model/plot_lasso_and_elasticnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
y = np.dot(X, coef)
2929

3030
# add noise
31-
y += 0.01 * np.random.normal((n_samples,))
31+
y += 0.01 * np.random.normal(size=n_samples)
3232

3333
# Split data in train set and test set
3434
n_samples = X.shape[0]

0 commit comments

Comments
 (0)
0