FIX: Add allow_nans option to check_arrays

Grid search and cross validation should not panic when seeing NaNs
in the input arrays, because that breaks Imputer.
Fixes #2774 and #3044.