File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 2424from numpy .core .numeric import ComplexWarning
2525from sklearn .utils .validation import (_num_samples , _ensure_no_complex_data ,
2626 _ensure_sparse_format , column_or_1d ,
27- check_consistent_length )
27+ check_consistent_length , _assert_all_finite )
28+ from sklearn .utils .extmath import _safe_accumulator_op
2829from .._utils import is_DataFrame , get_dtype , get_number_of_types
2930
3031
3132def _daal_assert_all_finite (X , allow_nan = False , msg_dtype = None ):
32- """Like assert_all_finite, but only for ndarray."""
33- # validation is also imported in extmath
34- from sklearn .utils .extmath import _safe_accumulator_op
35-
3633 if _get_config ()['assume_finite' ]:
3734 return
3835
36+ # Data with small size has too big relative overhead
37+ # TODO: tune threshold size
38+ if hasattr (X , 'size' ):
39+ if X .size < 32768 :
40+ _assert_all_finite (X , allow_nan = allow_nan , msg_dtype = msg_dtype )
41+ return
42+
3943 is_df = is_DataFrame (X )
4044 num_of_types = get_number_of_types (X )
4145
You can’t perform that action at this time.
0 commit comments