check_estimator assumes too much about 3rd-party estimators
See original GitHub issueI am writing an estimator that I’d like to make compatible with scikit-learn. My estimator has a parameter/field called n_components. Note that the purpose/meaning/intent of this parameter is different from parameters of the same name of existing scikit-learn estimators (e.g. LinearDiscriminantAnalysis or LinearDiscriminantAnalysis).
When I run check_estimator() on my model it fais because check_estimator() modifies my n_components field in this piece of code
There are plenty more places in estimator_checks.py where estimators’ n_components or n_clusters fields are being set to specific values without checking for estimator type. At the very least type checks should be added to all of those cases in a manner similar to this “ugly” piece of code.
Looks like this issue might be complementary to https://github.com/scikit-learn/scikit-learn/issues/6715 which deals with check_estimator() not being general enough.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
Could this be related with #16241 in some way?
Definitely, if you want to open a separate PR to address your particular issue please do so.
Indeed, another example of such issues there.