NF: Randomized Parcellation Based Inference

Tadaaaaam... Implementation of Randomized Parcellation Based Inference [1].

Main accomplished tasks:
* Refactoring: move some functions that were common to permuted OLS and RPBI into a utils.py file.
  orthonormalize_design/matrix, f_score computation, ...
  Tests have been changed accordingly.
* Re-introduce GrowableSparseArrays (and corresponding tests).
  They have already been reviewed in a former PR about permuted OLS before they were finally removed.
  Now, we needed to re-introduce them because we need to address the data efficiently, in different 
  manners and for different purposes.
* Introduce some functions to generate/deal with randomized parcellations.
  They could be moved to a more generic module that serves this purpose (creating multiple
  random parcellations, transforming a dataset with all of the built parcellations)
* Examples: the three examples on massively univariate analysis have been duplicated and RPBI is now
  applied. This is a lot of examples, but they will be structured at some point (see issue #195).
  Issue: examples can take up to 30 minutes on a laptop, using one single CPU (see discussion below).

The code for RPBI is optimized but a run of the algorithm remains costly. This is because RPBI requires the computation of many parcellations (97% of the total execution time). Only 3% of the computation time is spent on the permutations, when 10,000 are performed (which is already kind of a lot, but recommended).
Fortunately, both the computation of the parcellation and the statistical inference part can be parallelized.
Therefore, on a 10-core station, the computation time boils down to less than three minutes, which is acceptable. Still, the examples policy requires that n_jobs=1 by default.

[1] Benoit Da Mota et al. Randomized parcellation based inference, NeuroImage, Volume 89, 1 April 2014.
I think that this discussion is really highlighting a difficulty of the code: I can never fit in my head what this structure corresponds to. We need to find good names and good comments. 

<div>-------- Original message --------</div><div>From: Virgile Fritsch <notifications@github.com> </div><div>Date:19/06/2014  09:04  (GMT+01:00) </div><div>To: nilearn/nilearn <nilearn@noreply.github.com> </div><div>Cc: Gael Varoquaux <gael.varoquaux@normalesup.org> </div><div>Subject: Re: [nilearn] NF: Randomized Parcellation Based Inference (#196) </div><div>
</div>In nilearn/mass_univariate/rpbi.py:

> +    (iii) a target variate.
> +    Memory is pre-allocated to store a large number of scores. The structure
> +    can be indexed efficiently according to three dimensions to add new
> +    scores at the right position fast.
> +    The allocated space can be extended if needed, but we want to avoid this
> +    because it is costly. User should carefully initialize the structure.
> +    Only scores above a predetermined threshold are actually stored, others
> +    are ignored.
> +
> +    Attributes
> +    ----------
> +    n_elts: int
> +      The total number of scores actually stored into the data structure
> +
> +    n_iter: int
> +      Number of trials (using as many iterators)
Well there are only three "named" axes/dimensions, no indices properly speaking. One dimension is used to index the permutation number and is called "iter" (or "perm"). The second and third dimensions are used to index a target variate ('y') and a tested variate ('x').
…
—
Reply to this email directly or view it on GitHub.