Skip to content

Commit 574a215

Browse files
committed
Fixed travis and addressed comments
1 parent b1988db commit 574a215

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

sklearn/linear_model/coordinate_descent.py

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ class ElasticNet(LinearModel, RegressorMixin):
487487
488488
Minimizes the objective function::
489489
490-
1 / (2 * n_samples) * ||y - Xw||^2_2
490+
1 / (2 * n_samples) * ||y - Xw||^2_2 +
491491
+ alpha * l1_ratio * ||w||_1
492492
+ 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2
493493
@@ -531,7 +531,7 @@ class ElasticNet(LinearModel, RegressorMixin):
531531
normalize : boolean, optional, default False
532532
If ``True``, the regressors X will be normalized before regression.
533533
534-
precompute : True | False | array-like
534+
precompute : True | False | 'auto' | array-like
535535
Whether to use a precomputed Gram matrix to speed up
536536
calculations. If set to ``'auto'`` let us decide. The Gram
537537
matrix can also be passed as argument. For sparse input
@@ -642,6 +642,12 @@ def fit(self, X, y, check_input=True):
642642
"well. You are advised to use the LinearRegression "
643643
"estimator", stacklevel=2)
644644

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)
645651
# We expect X and y to be already float64 Fortran ordered arrays
646652
# when bypassing checks
647653
if check_input:
@@ -782,11 +788,13 @@ class Lasso(ElasticNet):
782788
copy_X : boolean, optional, default True
783789
If ``True``, X will be copied; else, it may be overwritten.
784790
785-
precompute : True | False | array-like, default=False
791+
precompute : True | False | 'auto' | array-like
786792
Whether to use a precomputed Gram matrix to speed up
787793
calculations. If set to ``'auto'`` let us decide. The Gram
788794
matrix can also be passed as argument. For sparse input
789795
this option is always ``True`` to preserve sparsity.
796+
WARNING : The ``'auto'`` option is deprecated and will
797+
be removed in 0.18.
790798
791799
max_iter : int, optional
792800
The maximum number of iterations
@@ -1159,7 +1167,6 @@ def fit(self, X, y):
11591167
else:
11601168
self.alphas_ = np.asarray(alphas[0])
11611169

1162-
self.mse_path_ = np.squeeze(all_mse_paths)
11631170
self.best_score_ = best_mse
11641171
self.best_params_ = {'alpha': best_alpha, 'l1_ratio': best_l1_ratio}
11651172

@@ -1224,11 +1231,10 @@ class LassoCV(LinearModelCV, RegressorMixin):
12241231
cv : int, cross-validation generator or an iterable, optional
12251232
Determines the cross-validation splitting strategy.
12261233
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.
12321238
12331239
For integer/None inputs, :class:`KFold` is used.
12341240
@@ -1387,11 +1393,10 @@ class ElasticNetCV(LinearModelCV, RegressorMixin):
13871393
cv : int, cross-validation generator or an iterable, optional
13881394
Determines the cross-validation splitting strategy.
13891395
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.
13951400
13961401
For integer/None inputs, :class:`KFold` is used.
13971402
@@ -1481,7 +1486,7 @@ class ElasticNetCV(LinearModelCV, RegressorMixin):
14811486
while alpha corresponds to the lambda parameter in glmnet.
14821487
More specifically, the optimization objective is::
14831488
1484-
1 / (2 * n_samples) * ||y - Xw||^2_2
1489+
1 / (2 * n_samples) * ||y - Xw||^2_2 +
14851490
+ alpha * l1_ratio * ||w||_1
14861491
+ 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2
14871492
@@ -1670,7 +1675,7 @@ def fit(self, X, y):
16701675
# X and y must be of type float64
16711676
X = check_array(X, dtype=np.float64, order='F',
16721677
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)
16741679

16751680
if hasattr(self, 'l1_ratio'):
16761681
model_str = 'ElasticNet'
@@ -1890,11 +1895,10 @@ class MultiTaskElasticNetCV(LinearModelCV, RegressorMixin):
18901895
cv : int, cross-validation generator or an iterable, optional
18911896
Determines the cross-validation splitting strategy.
18921897
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.
18981902
18991903
For integer/None inputs, :class:`KFold` is used.
19001904
@@ -2020,7 +2024,7 @@ class MultiTaskLassoCV(LinearModelCV, RegressorMixin):
20202024
20212025
alphas : array-like, optional
20222026
List of alphas where to compute the models.
2023-
If not provided, set automatically.
2027+
If not provided, set automaticlly.
20242028
20252029
n_alphas : int, optional
20262030
Number of alphas along the regularization path
@@ -2048,11 +2052,10 @@ class MultiTaskLassoCV(LinearModelCV, RegressorMixin):
20482052
cv : int, cross-validation generator or an iterable, optional
20492053
Determines the cross-validation splitting strategy.
20502054
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.
20562059
20572060
For integer/None inputs, :class:`KFold` is used.
20582061

0 commit comments

Comments
 (0)