Skip to content

Commit

Permalink
Testing: ignore kernal pca config error with sparse data (#1368)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
eddiebergman authored Jan 12, 2022
1 parent b58be50 commit b0142bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
15 changes: 6 additions & 9 deletions test/test_pipeline/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import resource
import tempfile
import traceback
import unittest
import unittest.mock

Expand Down Expand Up @@ -519,8 +518,7 @@ def _test_configurations(
except np.linalg.LinAlgError:
continue
except ValueError as e:
if "Floating-point under-/overflow occurred at epoch" in \
e.args[0]:
if "Floating-point under-/overflow occurred at epoch" in e.args[0]:
continue
elif "removed all features" in e.args[0]:
continue
Expand All @@ -536,8 +534,7 @@ def _test_configurations(
elif 'Internal work array size computation failed' in e.args[0]:
continue
else:
print(config)
print(traceback.format_exc())
e.args += (f"config={config}",)
raise e

except RuntimeWarning as e:
Expand All @@ -554,15 +551,14 @@ def _test_configurations(
elif "invalid value encountered in multiply" in e.args[0]:
continue
else:
print(traceback.format_exc())
print(config)
e.args += (f"config={config}",)
raise e

except UserWarning as e:
if "FastICA did not converge" in e.args[0]:
continue
else:
print(traceback.format_exc())
print(config)
e.args += (f"config={config}",)
raise e

def test_get_hyperparameter_search_space(self):
Expand Down Expand Up @@ -1175,6 +1171,7 @@ def test_fit_instantiates_component(self):
# to clean up with check in the future
del preprocessing_components.additional_components.components['CrashPreprocessor']
self.fail("cs={} config={} Exception={}".format(cs, config, e))

cls.set_hyperparameters(config)

with self.assertRaisesRegex(ValueError, "Make sure fit is called"):
Expand Down
20 changes: 10 additions & 10 deletions test/test_pipeline/test_regression.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import copy
import itertools
import resource
import sys
import tempfile
import traceback
import unittest
import unittest.mock

Expand Down Expand Up @@ -216,10 +214,13 @@ def _test_configurations(self, configurations_space, make_sparse=False,
elif 'The condensed distance matrix must contain only finite ' \
'values.' in e.args[0]:
continue
elif "zero-size array to reduction operation maximum which has no " \
"identity" in e.args[0]:
continue
else:
print(config)
print(traceback.format_exc())
e.args += (f"config={config}",)
raise e

except RuntimeWarning as e:
if "invalid value encountered in sqrt" in e.args[0]:
continue
Expand All @@ -232,22 +233,21 @@ def _test_configurations(self, configurations_space, make_sparse=False,
elif "invalid value encountered in multiply" in e.args[0]:
continue
else:
print(config)
traceback.print_tb(sys.exc_info()[2])
e.args += (f"config={config}",)
raise e

except UserWarning as e:
if "FastICA did not converge" in e.args[0]:
continue
else:
print(config)
traceback.print_tb(sys.exc_info()[2])
e.args += (f"config={config}",)
raise e

except Exception as e:
if "Multiple input features cannot have the same target value" in e.args[0]:
continue
else:
print(config)
traceback.print_tb(sys.exc_info()[2])
e.args += (f"config={config}",)
raise e

def test_default_configuration(self):
Expand Down

0 comments on commit b0142bc

Please sign in to comment.