-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
Currently, schema-checking raises an internal assertion for constraints of the form X/isSparse that are "bare", i.e., not inside of an anyOf.
Test to reproduce:
import jsonschema
import scipy.sparse
import sklearn.datasets
import sklearn.decomposition
import unittest
import lale.lib.sklearn
class TestBareSparsenessConstraint(unittest.TestCase):
def setUp(self):
X, y = sklearn.datasets.load_iris(return_X_y=True)
self.sparse_X = scipy.sparse.csr_matrix(X)
self.y = y
def test_bare_sparseness_constraint(self):
#without Lale
trainable = sklearn.decomposition.PCA()
with self.assertRaisesRegex(TypeError, "PCA does not support sparse"):
trained = trainable.fit(self.sparse_X, self.y)
#with Lale and schema validation
with EnableSchemaValidation():
trainable = lale.lib.sklearn.PCA()
with self.assertRaises(jsonschema.ValidationError):
trained = trainable.fit(self.sparse_X, self.y)Output:
File "lale/lale/operators.py", line 1984, in _validate_hyperparams
assert e.schema_path[2] == "anyOf"
AssertionError
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels