(WIP) Sparse models: S-LASSO and TV-l1

- Supports TV-l1 and S-LASSO priors
- Supports logistic and squared losses
- Has cross validation
- Can automatically select alpha by CV (+ automatic computation of useful alpha ranges for the CV)
- Warning: User must supply l1_ratio
einsum is fanciful, but i'm not sure it's faster.

On Mon, Oct 20, 2014 at 11:49 AM, eickenberg <notifications@github.com>
wrote:

> In nilearn/decoding/space_net_solvers.py:
>
> > +        model_size, dgap_factor=(.1 + l1_ratio) ** 2, callback=callback,
> > +        tol=tol, max_iter=max_iter, verbose=verbose, init=init)
> > +
> > +
> > +def _tvl1_objective_from_gradient(gradient):
> > +    """Computes TV-l1 objective function from gradient.
> > +
> > +    Parameters
> > +    ----------
> > +    gradient: ndarray, shape (4, nx, ny, nz)
> > +       precomputed "gradient + id" array
> > +
> > +    """
> > +
> > +    tv_term = np.sum(np.sqrt(np.sum(gradient[:-1] * gradient[:-1],
> > +                                    axis=0)))
>
> If, as the doctring indicates, we know that we are in 4D, a copy could be
> saved using np.sum(np.sqrt(np.einsum("ijkl, ijkl -> jkl", gradient[:-1]))).
> But this may or may not be relevant in a benchmark.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/nilearn/nilearn/pull/219/files#r19075906>.
>



-- 
DED