Repository: nilearn/nilearn

Issue:
SpaceNet: Smooth-lasso vs graph-net
I remembered a comment about graph-net / smooth-lasso. I can see both in the doc. Is there something to do about that?



Discussion:
smooth-lasso was supposed to be removed everywhere iirc

On Wednesday, July 29, 2015, Alexandre Abraham notifications@github.com
wrote:

> I remembered a comment about graph-net / smooth-lasso. I can see both in
> the doc. Is there something to do about that?
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/nilearn/nilearn/issues/724.

> smooth-lasso was supposed to be removed everywhere iirc

Yes, this is what happened.

> Yes, this is what happened.

Not completely I guess:

```
❯ git grep 'smooth.lasso'
doc/decoding/space_net.rst:penalty="smooth-lasso") to regularize classification and regression
doc/decoding/space_net.rst:- Graph-Net: `penalty="smooth-lasso"` (this is the default prior in
```

Also there is a nilearn/decoding/tests/test_smooth_lasso.py

and some smoothlasso in nilearn/decoding/tests/test_same_api.py:

```
❯ git grep 'smoothlasso'
nilearn/decoding/tests/test_same_api.py:def test_smoothlasso_and_tvl1_same_for_pure_l1(max_iter=100, decimal=2):
nilearn/decoding/tests/test_same_api.py:    # smoothlasso_solver and tvl1_solver should give same results
nilearn/decoding/tests/test_same_api.py:def test_smoothlasso_and_tvl1_same_for_pure_l1_logistic(max_iter=20,
nilearn/decoding/tests/test_same_api.py:    # smoothlasso_solver and tvl1_solver should give same results
nilearn/decoding/tests/test_same_api.py:def test_smoothlasso_and_tv_same_for_pure_l1_another_test(decimal=1):
nilearn/decoding/tests/test_same_api.py:    # smoothlasso_solver and tvl1_solver should give same results
```

OK, I create a small branch to fix these minors issues. Thanks for reporting.


Resolving patch:
diff --git a/nilearn/decoding/space_net_solvers.py b/nilearn/decoding/space_net_solvers.py
--- a/nilearn/decoding/space_net_solvers.py
+++ b/nilearn/decoding/space_net_solvers.py
@@ -235,10 +235,9 @@ def _logistic_data_loss_and_spatial_grad_derivative(X, y, w, mask,
 
 
 def _graph_net_squared_loss(X, y, alpha, l1_ratio, mask, init=None,
-                              max_iter=1000, tol=1e-4, callback=None,
-                              lipschitz_constant=None, verbose=0):
-    """Computes a solution for the Graph-Net regression problem, as in the
-    SmoothLassoRegressor estimator, with no data preprocessing.
+                            max_iter=1000, tol=1e-4, callback=None,
+                            lipschitz_constant=None, verbose=0):
+    """Computes a solution for the Graph-Net regression problem.
 
     This function invokes the mfista backend (from fista.py) to solve the
     underlying optimization problem.


Test patch:
diff --git a/nilearn/decoding/tests/test_same_api.py b/nilearn/decoding/tests/test_same_api.py
--- a/nilearn/decoding/tests/test_same_api.py
+++ b/nilearn/decoding/tests/test_same_api.py
@@ -96,9 +96,9 @@ def test_lipschitz_constant_loss_logreg():
     assert_equal(a, b)
 
 
-def test_smoothlasso_and_tvl1_same_for_pure_l1(max_iter=100, decimal=2):
+def test_graph_net_and_tvl1_same_for_pure_l1(max_iter=100, decimal=2):
     ###############################################################
-    # smoothlasso_solver and tvl1_solver should give same results
+    # graph_net_solver and tvl1_solver should give same results
     # when l1_ratio = 1.
     ###############################################################
 
@@ -132,10 +132,10 @@ def test_smoothlasso_and_tvl1_same_for_pure_l1(max_iter=100, decimal=2):
                                              decimal=decimal)
 
 
-def test_smoothlasso_and_tvl1_same_for_pure_l1_logistic(max_iter=20,
+def test_graph_net_and_tvl1_same_for_pure_l1_logistic(max_iter=20,
                                                         decimal=2):
     ###############################################################
-    # smoothlasso_solver and tvl1_solver should give same results
+    # graph_net_solver and tvl1_solver should give same results
     # when l1_ratio = 1.
     ###############################################################
 
@@ -148,7 +148,7 @@ def test_smoothlasso_and_tvl1_same_for_pure_l1_logistic(max_iter=20,
 
     # results should be exactly the same for pure lasso
     a = _graph_net_logistic(X, y, alpha, 1., mask=mask,
-                              max_iter=max_iter)[0]
+                            max_iter=max_iter)[0]
     b = tvl1_solver(X, y, alpha, 1., loss="logistic", mask=mask,
                     max_iter=max_iter)[0]
     for standardize in [True, False]:
@@ -165,9 +165,9 @@ def test_smoothlasso_and_tvl1_same_for_pure_l1_logistic(max_iter=20,
                                          decimal=decimal)
 
 
-def test_smoothlasso_and_tv_same_for_pure_l1_another_test(decimal=1):
+def test_graph_net_and_tv_same_for_pure_l1_another_test(decimal=1):
     ###############################################################
-    # smoothlasso_solver and tvl1_solver should give same results
+    # graph_net_solver and tvl1_solver should give same results
     # when l1_ratio = 1.
     ###############################################################