alibi
alibi copied to clipboard
Pydantic runtime type validation
In light of https://github.com/SeldonIO/alibi/pull/511#issuecomment-950861810 let's test pydantic
approach to runtime type validaton.
Updating the decorator to @validate_arguments(config=dict(arbitrary_types_allowed=True))
allows type-checking of arbitrary objects such as np.ndarray
.
Now it seems the decorator struggles with forward refs such as those that are returned from fit
methods (i.e. the class itself is returned).
See bug/limitation here: https://github.com/samuelcolvin/pydantic/issues/2901
Another note, pydantic
currently doesn't validate the return type at all.