@@ -889,7 +889,13 @@ def _path_residuals(X, y, train, test, path, path_params, alphas=None,
889
889
y_test = y [test ]
890
890
fit_intercept = path_params ['fit_intercept' ]
891
891
normalize = path_params ['normalize' ]
892
- precompute = path_params ['precompute' ]
892
+
893
+ if y .ndim == 1 :
894
+ precompute = path_params ['precompute' ]
895
+ else :
896
+ # No Gram variant of multi-task exists right now.
897
+ # Fall back to default enet_multitask
898
+ precompute = False
893
899
894
900
X_train , y_train , X_mean , y_mean , X_std , precompute , Xy = \
895
901
_pre_fit (X_train , y_train , None , precompute , normalize , fit_intercept ,
@@ -1638,11 +1644,6 @@ class MultiTaskElasticNetCV(LinearModelCV, RegressorMixin):
1638
1644
List of alphas where to compute the models.
1639
1645
If not provided, set automatically.
1640
1646
1641
- precompute : True | False | 'auto' | array-like
1642
- Whether to use a precomputed Gram matrix to speed up
1643
- calculations. If set to ``'auto'`` let us decide. The Gram
1644
- matrix can also be passed as argument.
1645
-
1646
1647
n_alphas : int, optional
1647
1648
Number of alphas along the regularization path
1648
1649
@@ -1716,8 +1717,7 @@ class MultiTaskElasticNetCV(LinearModelCV, RegressorMixin):
1716
1717
... #doctest: +NORMALIZE_WHITESPACE
1717
1718
MultiTaskElasticNetCV(alphas=None, copy_X=True, cv=None, eps=0.001,
1718
1719
fit_intercept=True, l1_ratio=0.5, max_iter=1000, n_alphas=100,
1719
- n_jobs=1, normalize=False, precompute='auto', tol=0.0001,
1720
- verbose=0)
1720
+ n_jobs=1, normalize=False, tol=0.0001, verbose=0)
1721
1721
>>> print(clf.coef_)
1722
1722
[[ 0.52875032 0.46958558]
1723
1723
[ 0.52875032 0.46958558]]
@@ -1740,7 +1740,7 @@ class MultiTaskElasticNetCV(LinearModelCV, RegressorMixin):
1740
1740
path = staticmethod (enet_path )
1741
1741
1742
1742
def __init__ (self , l1_ratio = 0.5 , eps = 1e-3 , n_alphas = 100 , alphas = None ,
1743
- fit_intercept = True , normalize = False , precompute = 'auto' ,
1743
+ fit_intercept = True , normalize = False ,
1744
1744
max_iter = 1000 , tol = 1e-4 , cv = None , copy_X = True ,
1745
1745
verbose = 0 , n_jobs = 1 ):
1746
1746
self .l1_ratio = l1_ratio
@@ -1749,7 +1749,6 @@ def __init__(self, l1_ratio=0.5, eps=1e-3, n_alphas=100, alphas=None,
1749
1749
self .alphas = alphas
1750
1750
self .fit_intercept = fit_intercept
1751
1751
self .normalize = normalize
1752
- self .precompute = precompute
1753
1752
self .max_iter = max_iter
1754
1753
self .tol = tol
1755
1754
self .cv = cv
@@ -1781,11 +1780,6 @@ class MultiTaskLassoCV(LinearModelCV, RegressorMixin):
1781
1780
List of alphas where to compute the models.
1782
1781
If not provided, set automaticlly.
1783
1782
1784
- precompute : True | False | 'auto' | array-like
1785
- Whether to use a precomputed Gram matrix to speed up
1786
- calculations. If set to ``'auto'`` let us decide. The Gram
1787
- matrix can also be passed as argument.
1788
-
1789
1783
n_alphas : int, optional
1790
1784
Number of alphas along the regularization path
1791
1785
@@ -1856,10 +1850,10 @@ class MultiTaskLassoCV(LinearModelCV, RegressorMixin):
1856
1850
path = staticmethod (lasso_path )
1857
1851
1858
1852
def __init__ (self , eps = 1e-3 , n_alphas = 100 , alphas = None , fit_intercept = True ,
1859
- normalize = False , precompute = 'auto' , max_iter = 1000 , tol = 1e-4 ,
1860
- copy_X = True , cv = None , verbose = False , n_jobs = 1 ):
1853
+ normalize = False , max_iter = 1000 , tol = 1e-4 , copy_X = True ,
1854
+ cv = None , verbose = False , n_jobs = 1 ):
1861
1855
super (MultiTaskLassoCV , self ).__init__ (
1862
1856
eps = eps , n_alphas = n_alphas , alphas = alphas ,
1863
1857
fit_intercept = fit_intercept , normalize = normalize ,
1864
- precompute = precompute , max_iter = max_iter , tol = tol , copy_X = copy_X ,
1858
+ max_iter = max_iter , tol = tol , copy_X = copy_X ,
1865
1859
cv = cv , verbose = verbose , n_jobs = n_jobs )
0 commit comments