tpcp.clone#

tpcp.clone(algorithm: tpcp._base.T, *, safe: bool = False) tpcp._base.T[source]#

Construct a new algorithm object with the same parameters.

This is a modified version from sklearn and the original was published under a BSD-3 license and the original file can be found here: https://github.com/scikit-learn/scikit-learn/blob/0d378913b/sklearn/base.py#L31

The method creates a copy of tpcp algorithms and pipelines, without any results attached. I.e. it is equivalent to creating a new instance with the same parameter. For all objects that are not tpcp objects (or lists of them), a deepcopy is created.

Warning

This function will not clone sklearn models as expected! sklearn.clone will remove the trained model from sklearn object by creating a new instance. This clone method, will deepcopy sklearn models. This means fitted models will be copied and are still available afterwards. For more information have a look at the documentation about “inputs and results” in tpcp. TODO: Link

Parameters
algorithm{list, tuple, set} of algorithm instance or a single algorithm instance

The algorithm or group of algorithms to be cloned.

safebool, default=False

If safe is False, clone will fall back to a deep copy on objects that are not algorithms.