[MRG+2] FIX: Add allow_nans option to check_arrays

In some cases (in particular during grid search and cross validation)
check_arrays should not panic when seeing NaNs in the input arrays.
Fixes #2774 and #3044.