-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fix cloning of config for nested objects #275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Astutely observed.
However, question, given that there are two points of recursion
- the first, this deals with nesting in lists etc.
- the second,
new_object_params[name] = self._clone(param, safe=False)
, this deals with direct nesting.
Naively, I would think we do not need to change the first occurrence, current line 228, because we go back to _clone
and from there to line current 250.
Further, non-blocking question, I was wondering: should we make the contract less strict about inheritance, and more about interfaces, would it make sense to do hasattr(param, "clone") and hasattr(param, "_config")
? Or perhaps it is safer to make the deviation from sklearn
more strict, which is the current state. I tend towards the latter.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #275 +/- ##
==========================================
+ Coverage 84.69% 84.73% +0.03%
==========================================
Files 43 43
Lines 2928 2928
==========================================
+ Hits 2480 2481 +1
+ Misses 448 447 -1 ☔ View full report in Codecov by Sentry. |
I changed the implementation to just do the config cloning inside the |
With the current implementation (see latest changes) this is not relevant anymore. Could you take a look? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very elegant!
Putting the set_config
at the recursion nodes rather than having it just in the top node solves the problem conclusively and elegantly. Nice.
Cohesion is maintained since the total number of calls does not change, and _clone
gets to handle set_params
and set_config
, so even that is improved.
You should also add yourself here: https://github.com/sktime/skbase/blob/main/.all-contributorsrc
|
Since you are asking: in-principle no concerns. The history behind Ultimately, one high-level compatibility/interoperability requirement for Funnily, |
5d4556a
to
35ffcf8
Compare
I see... Just for reference, I'm attaching a visual diff between the current Summary of differences:
I need to think more about this to give any meaningful input here.
@fkiraly definitely |
Reference Issues/PRs
Fixes #276
What does this implement/fix? Explain your changes.
Please refer to: #276
Does your contribution introduce a new dependency? If yes, which one?
No
What should a reviewer concentrate their feedback on?
The
_clone()
method has a# copied from sklearn
comment above it. Any concerns with modifying this method? Any alternative solutions come to mind?PR checklist
For all contributions
the PR topic is related to enhancement, CI/CD, maintenance, documentation, or a bug.
For code contributions