Skip to content

Commit 2864699

Browse files
committed
Testing: ignore kernal pca config error with sparse data (#1368)
* Fix: Raises errors with the config * Add: Skip error for kernal_pca Seems kernel_pca emits the error: * `"zero-size array to reduction operation maximum which has no identity"` This is gotten on the line `max_eig = lambdas.max()` which makes me assume it emits a matrix with no real eigen values, not something we can really control for
1 parent bb08d04 commit 2864699

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

test/test_pipeline/test_classification.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
import resource
77
import tempfile
8-
import traceback
98
import unittest
109
import unittest.mock
1110

@@ -519,8 +518,7 @@ def _test_configurations(
519518
except np.linalg.LinAlgError:
520519
continue
521520
except ValueError as e:
522-
if "Floating-point under-/overflow occurred at epoch" in \
523-
e.args[0]:
521+
if "Floating-point under-/overflow occurred at epoch" in e.args[0]:
524522
continue
525523
elif "removed all features" in e.args[0]:
526524
continue
@@ -536,8 +534,7 @@ def _test_configurations(
536534
elif 'Internal work array size computation failed' in e.args[0]:
537535
continue
538536
else:
539-
print(config)
540-
print(traceback.format_exc())
537+
e.args += (f"config={config}",)
541538
raise e
542539

543540
except RuntimeWarning as e:
@@ -554,15 +551,14 @@ def _test_configurations(
554551
elif "invalid value encountered in multiply" in e.args[0]:
555552
continue
556553
else:
557-
print(traceback.format_exc())
558-
print(config)
554+
e.args += (f"config={config}",)
559555
raise e
556+
560557
except UserWarning as e:
561558
if "FastICA did not converge" in e.args[0]:
562559
continue
563560
else:
564-
print(traceback.format_exc())
565-
print(config)
561+
e.args += (f"config={config}",)
566562
raise e
567563

568564
def test_get_hyperparameter_search_space(self):
@@ -1175,6 +1171,7 @@ def test_fit_instantiates_component(self):
11751171
# to clean up with check in the future
11761172
del preprocessing_components.additional_components.components['CrashPreprocessor']
11771173
self.fail("cs={} config={} Exception={}".format(cs, config, e))
1174+
11781175
cls.set_hyperparameters(config)
11791176

11801177
with self.assertRaisesRegex(ValueError, "Make sure fit is called"):

test/test_pipeline/test_regression.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import copy
22
import itertools
33
import resource
4-
import sys
54
import tempfile
6-
import traceback
75
import unittest
86
import unittest.mock
97

@@ -216,10 +214,13 @@ def _test_configurations(self, configurations_space, make_sparse=False,
216214
elif 'The condensed distance matrix must contain only finite ' \
217215
'values.' in e.args[0]:
218216
continue
217+
elif "zero-size array to reduction operation maximum which has no " \
218+
"identity" in e.args[0]:
219+
continue
219220
else:
220-
print(config)
221-
print(traceback.format_exc())
221+
e.args += (f"config={config}",)
222222
raise e
223+
223224
except RuntimeWarning as e:
224225
if "invalid value encountered in sqrt" in e.args[0]:
225226
continue
@@ -232,22 +233,21 @@ def _test_configurations(self, configurations_space, make_sparse=False,
232233
elif "invalid value encountered in multiply" in e.args[0]:
233234
continue
234235
else:
235-
print(config)
236-
traceback.print_tb(sys.exc_info()[2])
236+
e.args += (f"config={config}",)
237237
raise e
238+
238239
except UserWarning as e:
239240
if "FastICA did not converge" in e.args[0]:
240241
continue
241242
else:
242-
print(config)
243-
traceback.print_tb(sys.exc_info()[2])
243+
e.args += (f"config={config}",)
244244
raise e
245+
245246
except Exception as e:
246247
if "Multiple input features cannot have the same target value" in e.args[0]:
247248
continue
248249
else:
249-
print(config)
250-
traceback.print_tb(sys.exc_info()[2])
250+
e.args += (f"config={config}",)
251251
raise e
252252

253253
def test_default_configuration(self):

0 commit comments

Comments
 (0)