question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

check_estimator assumes too much about 3rd-party estimators

See original GitHub issue

I 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:open
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cmarmocommented, Jan 30, 2020

Could this be related with #16241 in some way?

0reactions
rthcommented, Jan 30, 2020

Definitely, if you want to open a separate PR to address your particular issue please do so.

Could this be related with #16241 in some way?

Indeed, another example of such issues there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

sklearn.utils.estimator_checks.check_estimator
Check if estimator adheres to scikit-learn conventions. This function will run an extensive test-suite for input validation, shapes, etc, making sure that the ......
Read more >
Mock Unit Test for a REST API callout
I assume the aim is to test your own code not the 3rd party code so this aims to do the minimum to...
Read more >
scikit-learn: sklearn/utils/estimator_checks.py - Fossies
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting...
Read more >
java - Handling changes in dependent 3rd party libraries
You ask what is the "best practice" for this problem. I'm going to assume that by "this problem" you mean the problem of...
Read more >
Free Tax Calculators & Money Saving Tools 2022 ... - TurboTax
Estimate your tax refund, uncover deductions and credits, and more. ... Use our tax refund estimator to find out how much you'll get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found