-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
RandomTreesEmbedding.transform fails unhelpfully #12959
Copy link
Copy link
Closed
Description
sklearn: 0.20.0
When running a transform from an untrained RandomTreesEmbedding class, the failure message isn't helpful:
return self.one_hot_encoder_.transform(self.apply(X))
AttributeError: 'RandomTreesEmbedding' object has no attribute 'one_hot_encoder_'
This is because the method RandomTreesEmbedding.transform doesn't check for the existence of the fit before performing the transform. Since forest.py imports check_is_fitted, I think this can be solved by changing the method to add the line check_is_fitted(self, 'one_hot_encoder_') just before the return statement (the only line of code in the transform method).
I can do this and put in a pull request, if you like.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels