Thanks to visit codestin.com
Credit goes to github.com

Skip to content

__sklearn_clone__ protocol proposal #21838

@thomasjpfan

Description

@thomasjpfan

I propose a __sk_clone__ method that clone calls (if the method exist). This way arbitrary objects can define how they want to be cloned. This is similar to mechanism behind __sk_is_fitted__ + check_is_fitted.

Purpose

There are PR that run into issues with clone, and it would be nice to allow the estimator to define how it wants to be cloned.

  1. Metadata routing: Base sample-prop implementation and docs #21284 Needed to change clone to copy an private attribute that is configured outside of __init__
  2. Search spaces in estimator: Initial implementation of GridFactory #21784 (comment) the search space itself needs to be copied over when clone gets called.
  3. Ability to customize cloning: Strict identity parameter check in sklearn.base.clone #15371 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions