Skip to content
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

[ENH] refactor _clone to a plugin structure #381

Merged
merged 34 commits into from
Nov 13, 2024
Merged

[ENH] refactor _clone to a plugin structure #381

merged 34 commits into from
Nov 13, 2024

Conversation

fkiraly
Copy link
Contributor

@fkiraly fkiraly commented Nov 9, 2024

This PR refactors the current _clone logic, which had a lot of if/else case distinctions (as in the sklearn native code) to a list of plugins that can be extended.

Above the refactor, it also adds a sklearn specific plugin that dispatches to sklearn clone, ensuring that configs get cloned as well.

An approach to sktime/sktime#7333, which would be solved directly after update.

An alternative to #380, with advantages:

  • sklearn compatibility is automatic, for any dependency of skbase
  • the plugins can later be extended easily, for instance in a case like the missing dict support

A test for sktime/sktime#7333, namely that output configs are retained in sklearn objects, has been added.

@fkiraly fkiraly added implementing framework Implementing core skbase framework enhancement Adding new functionality labels Nov 9, 2024
@fkiraly fkiraly changed the title Clone plugins [ENH] refactor _clone to a plugin structure Nov 9, 2024
skbase/base/_clone_base.py Fixed Show fixed Hide fixed
skbase/base/_clone_plugins.py Fixed Show fixed Hide fixed
skbase/base/_clone_plugins.py Dismissed Show dismissed Hide dismissed
skbase/base/_clone_base.py Fixed Show fixed Hide fixed
skbase/base/_clone_base.py Fixed Show fixed Hide fixed
"""
__all__ = ["_clone", "_check_clone"]

from skbase.base._clone_plugins import DEFAULT_CLONE_PLUGINS

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
skbase.base._clone_plugins
begins an import cycle.
@fkiraly fkiraly merged commit badd7d4 into main Nov 13, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding new functionality implementing framework Implementing core skbase framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant