It is to avoid defining another function that performs the np.searchsorted
in parallel (code readability + overhead associated with splitting the data
once more to distribute computations).
See diff in commit 3daedc17dd.
Le 4 mars 2014 21:58, "bthirion" <notifications@github.com> a écrit :

> In nilearn/mass_univariate/permuted_least_squares.py:
>
> > +            shuffle_idx = rng.permutation(n_samples)
> > +            #rng.shuffle(shuffle_idx)
> > +            tested_vars = tested_vars[shuffle_idx]
> > +            if confounding_vars is not None:
> > +                confounding_vars = confounding_vars[shuffle_idx]
> > +
> > +        # OLS regression on randomized data
> > +        perm_scores = _f_score(tested_vars, target_vars, confounding_vars,
> > +                               lost_dof, normalized_design=True)
> > +        h0_fmax_part[i] = np.amax(perm_scores, 0)
> > +        # find the rank of the original scores in h0_part
> > +        # (when n_descriptors or n_perm are large, it can be quite long to
> > +        #  find the rank of the original scores into the whole H0 distribution.
> > +        #  Here, it is performed in parallel by the workers involded in the
> > +        #  permutation computation)
> > +        scores_as_ranks_part += (h0_fmax_part[i].reshape((-1, 1))
>
> OK, but I doubt that your current solution is efficient. Isn't
> searchsorted more readable ? WHat do you lose by using it ?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/nilearn/nilearn/pull/167/files#r10274219>
> .
>