Reputation: 141
How come the check_inverse
parameter in FunctionTransformer
does not throw an error?
In the FunctionTransformer
documentation, the parameter check_inverse
is defaulted to be True, and as far as I understand it, it checks that, for an array X, that f^-1(f(X))=X.
In the example given, it removes the first column of the array X. How come removing the first column, which is not an invertible operation, pass the test?
I was expecting there to be a warning that the condition is not fulfilled.
Upvotes: 1
Views: 106
Reputation: 3224
The reason for this is sadly only provided if you read the code. If no inverse function is given, the check is not applied:
if (self.check_inverse and not (self.func is None or
self.inverse_func is None)):
self._check_inverse_transform(X)
from FunctionTransformer.
Upvotes: 2