8000 Revert "FIX 'MultiTaskLasso' object has no attribute 'coef_' when war… · xhluca/scikit-learn@cdcd6bf · GitHub
[go: up one dir, main page]

Skip to content

Commit cdcd6bf

Browse files
author
Xing
committed
Revert "FIX 'MultiTaskLasso' object has no attribute 'coef_' when warm_start = True (scikit-learn#12361)"
This reverts commit cab496e.
1 parent 7eb12dc commit cdcd6bf

File tree

3 files changed

+1
-19
lines changed

3 files changed

+1
-19
lines changed

doc/whats_new/v0.21.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ Support for Python 3.4 and below has been officially dropped.
4040
- An entry goes here
4141
- An entry goes here
4242

43-
:mod:`sklearn.linear_model`
44-
...........................
45-
- |Fix| Fixed a bug in :class:`linear_model.MultiTaskElasticNet` which was breaking
46-
``MultiTaskElasticNet`` and ``MultiTaskLasso`` when ``warm_start = True``. :issue:`12360`
47-
by :user:`Aakanksha Joshi <joaak>`.
48-
4943
:mod:`sklearn.cluster`
5044
......................
5145

sklearn/linear_model/coordinate_descent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ def fit(self, X, y):
17951795
X, y, X_offset, y_offset, X_scale = _preprocess_data(
17961796
X, y, self.fit_intercept, self.normalize, copy=False)
17971797

1798-
if not self.warm_start or not hasattr(self, "coef_"):
1798+
if not self.warm_start or self.coef_ is None:
17991799
self.coef_ = np.zeros((n_tasks, n_features), dtype=X.dtype.type,
18001800
order='F')
18011801

sklearn/linear_model/tests/test_coordinate_descent.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -818,15 +818,3 @@ def test_coef_shape_not_zero():
818818
est_no_intercept = Lasso(fit_intercept=False)
819819
est_no_intercept.fit(np.c_[np.ones(3)], np.ones(3))
820820
assert est_no_intercept.coef_.shape == (1,)
821-
822-
823-
def test_warm_start_multitask_lasso():
824-
X, y, X_test, y_test = build_dataset()
825-
Y = np.c_[y, y]
826-
clf = MultiTaskLasso(alpha=0.1, max_iter=5, warm_start=True)
827-
ignore_warnings(clf.fit)(X, Y)
828-
ignore_warnings(clf.fit)(X, Y) # do a second round with 5 iterations
829-
830-
clf2 = MultiTaskLasso(alpha=0.1, max_iter=10)
831-
ignore_warnings(clf2.fit)(X, Y)
832-
assert_array_almost_equal(clf2.coef_, clf.coef_)

0 commit comments

Comments
 (0)
0