@agramfort : Isn't residues a 3-D array. so I have to take mean twice once across all examples and the next across all tasks, so that I end up with a 1-D array across alphas. If I just do mean, I will end up with a scalar value.