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.

passing types with get_params method to estimators

See original GitHub issue

currently get_params checks for the existence of the get_params method on the attributes during iteration, however this prevents passing types, which have a get_params methods because they will throw an exception when the method is called - since the object is not instantiated and get_params is not bound. I do not believe there is any negative impact here, unless params are being stored as class level attributes, otherwise a reference to the object is required. To patch this can I add a type exclusion criteria in BaseEstimator.get_params (extending the if deep and hasattr(value, 'get_params') criteria to exclude if isinstance(value, type) ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
amuellercommented, May 22, 2018

I don’t think we want to have get_params work as a static method.

0reactions
marksweissmacommented, May 24, 2018

@amueller it’s not OS yet so I can’t point you to it unfortunately. always good to make sure people are not reinventing the wheel 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developing scikit-learn estimators
The get_params function takes no arguments and returns a dict of the __init__ parameters of the estimator, together with their values. It must...
Read more >
sklearn.base — scikit-optimize 0.8.1 documentation
estimator_type = type(estimator) # XXX: not handling dictionaries if estimator_type in ... "estimator as it does not implement a " "'get_params' method.
Read more >
Select Right Generic Method with Reflection - Stack Overflow
This is when you pass the actual generic types you want to use in your method. Assuming you wanted the second method above:...
Read more >
Developing custom scikit-learn transformers and estimators
All constructor (the __init__ function) parameters should have default ... are of certain type, our estimator passes a class as an argument, ...
Read more >
Getting the Most out of scikit-learn Pipelines | by Jessica Miles
You can then pass this composite estimator to a GridSearchCV object and search over ... step to transform different types of data columns...
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