@@ -487,7 +487,7 @@ class ElasticNet(LinearModel, RegressorMixin):
487
487
488
488
Minimizes the objective function::
489
489
490
- 1 / (2 * n_samples) * ||y - Xw||^2_2
490
+ 1 / (2 * n_samples) * ||y - Xw||^2_2 +
491
491
+ alpha * l1_ratio * ||w||_1
492
492
+ 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2
493
493
@@ -531,7 +531,7 @@ class ElasticNet(LinearModel, RegressorMixin):
531
531
normalize : boolean, optional, default False
532
532
If ``True``, the regressors X will be normalized before regression.
533
533
534
- precompute : True | False | array-like
534
+ precompute : True | False | 'auto' | array-like
535
535
Whether to use a precomputed Gram matrix to speed up
536
536
calculations. If set to ``'auto'`` let us decide. The Gram
537
537
matrix can also be passed as argument. For sparse input
@@ -642,6 +642,12 @@ def fit(self, X, y, check_input=True):
642
642
"well. You are advised to use the LinearRegression "
643
643
"estimator" , stacklevel = 2 )
644
644
645
+ if (isinstance (self .precompute , six .string_types )
646
+ and self .precompute == 'auto' ):
647
+ warnings .warn ("Setting precompute to 'auto', was found to be "
648
+ "slower even when n_samples > n_features. Hence "
649
+ "it will be removed in 0.18." ,
650
+ DeprecationWarning , stacklevel = 2 )
645
651
# We expect X and y to be already float64 Fortran ordered arrays
646
652
# when bypassing checks
647
653
if check_input :
@@ -782,11 +788,13 @@ class Lasso(ElasticNet):
782
788
copy_X : boolean, optional, default True
783
789
If ``True``, X will be copied; else, it may be overwritten.
784
790
785
- precompute : True | False | array-like, default=False
791
+ precompute : True | False | 'auto' | array-like
786
792
Whether to use a precomputed Gram matrix to speed up
787
793
calculations. If set to ``'auto'`` let us decide. The Gram
788
794
matrix can also be passed as argument. For sparse input
789
795
this option is always ``True`` to preserve sparsity.
796
+ WARNING : The ``'auto'`` option is deprecated and will
797
+ be removed in 0.18.
790
798
791
799
max_iter : int, optional
792
800
The maximum number of iterations
@@ -1159,7 +1167,6 @@ def fit(self, X, y):
1159
1167
else :
1160
1168
self .alphas_ = np .asarray (alphas [0 ])
1161
1169
1162
- self .mse_path_ = np .squeeze (all_mse_paths )
1163
1170
self .best_score_ = best_mse
1164
1171
self .best_params_ = {'alpha' : best_alpha , 'l1_ratio' : best_l1_ratio }
1165
1172
@@ -1224,11 +1231,10 @@ class LassoCV(LinearModelCV, RegressorMixin):
1224
1231
cv : int, cross-validation generator or an iterable, optional
1225
1232
Determines the cross-validation splitting strategy.
1226
1233
Possible inputs for cv are:
1227
-
1228
- - None, to use the default 3-fold cross-validation,
1229
- - integer, to specify the number of folds.
1230
- - An object to be used as a cross-validation generator.
1231
- - An iterable yielding train/test splits.
1234
+ - None, to use the default 3-fold cross-validation,
1235
+ - integer, to specify the number of folds.
1236
+ - An object to be used as a cross-validation generator.
1237
+ - An iterable yielding train/test splits.
1232
1238
1233
1239
For integer/None inputs, :class:`KFold` is used.
1234
1240
@@ -1387,11 +1393,10 @@ class ElasticNetCV(LinearModelCV, RegressorMixin):
1387
1393
cv : int, cross-validation generator or an iterable, optional
1388
1394
Determines the cross-validation splitting strategy.
1389
1395
Possible inputs for cv are:
1390
-
1391
- - None, to use the default 3-fold cross-validation,
1392
- - integer, to specify the number of folds.
1393
- - An object to be used as a cross-validation generator.
1394
- - An iterable yielding train/test splits.
1396
+ - None, to use the default 3-fold cross-validation,
1397
+ - integer, to specify the number of folds.
1398
+ - An object to be used as a cross-validation generator.
1399
+ - An iterable yielding train/test splits.
1395
1400
1396
1401
For integer/None inputs, :class:`KFold` is used.
1397
1402
@@ -1481,7 +1486,7 @@ class ElasticNetCV(LinearModelCV, RegressorMixin):
1481
1486
while alpha corresponds to the lambda parameter in glmnet.
1482
1487
More specifically, the optimization objective is::
1483
1488
1484
- 1 / (2 * n_samples) * ||y - Xw||^2_2
1489
+ 1 / (2 * n_samples) * ||y - Xw||^2_2 +
1485
1490
+ alpha * l1_ratio * ||w||_1
1486
1491
+ 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2
1487
1492
@@ -1670,7 +1675,7 @@ def fit(self, X, y):
1670
1675
# X and y must be of type float64
1671
1676
X = check_array (X , dtype = np .float64 , order = 'F' ,
1672
1677
copy = self .copy_X and self .fit_intercept )
1673
- y = check_array (y , dtype = np .float64 , ensure_2d = False )
1678
+ y = check_array (y , dtype = np .float64 )
1674
1679
1675
1680
if hasattr (self , 'l1_ratio' ):
1676
1681
model_str = 'ElasticNet'
@@ -1890,11 +1895,10 @@ class MultiTaskElasticNetCV(LinearModelCV, RegressorMixin):
1890
1895
cv : int, cross-validation generator or an iterable, optional
1891
1896
Determines the cross-validation splitting strategy.
1892
1897
Possible inputs for cv are:
1893
-
1894
- - None, to use the default 3-fold cross-validation,
1895
- - integer, to specify the number of folds.
1896
- - An object to be used as a cross-validation generator.
1897
- - An iterable yielding train/test splits.
1898
+ - None, to use the default 3-fold cross-validation,
1899
+ - integer, to specify the number of folds.
1900
+ - An object to be used as a cross-validation generator.
1901
+ - An iterable yielding train/test splits.
1898
1902
1899
1903
For integer/None inputs, :class:`KFold` is used.
1900
1904
@@ -2020,7 +2024,7 @@ class MultiTaskLassoCV(LinearModelCV, RegressorMixin):
2020
2024
2021
2025
alphas : array-like, optional
2022
2026
List of alphas where to compute the models.
2023
- If not provided, set automatically .
2027
+ If not provided, set automaticlly .
2024
2028
2025
2029
n_alphas : int, optional
2026
2030
Number of alphas along the regularization path
@@ -2048,11 +2052,10 @@ class MultiTaskLassoCV(LinearModelCV, RegressorMixin):
2048
2052
cv : int, cross-validation generator or an iterable, optional
2049
2053
Determines the cross-validation splitting strategy.
2050
2054
Possible inputs for cv are:
2051
-
2052
- - None, to use the default 3-fold cross-validation,
2053
- - integer, to specify the number of folds.
2054
- - An object to be used as a cross-validation generator.
2055
- - An iterable yielding train/test splits.
2055
+ - None, to use the default 3-fold cross-validation,
2056
+ - integer, to specify the number of folds.
2057
+ - An object to be used as a cross-validation generator.
2058
+ - An iterable yielding train/test splits.
2056
2059
2057
2060
For integer/None inputs, :class:`KFold` is used.
2058
2061
0 commit comments