tpcp.clone#
- tpcp.clone(algorithm: T, *, safe: bool = False) 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: scikit-learn/scikit-learn
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. (see general concepts and sklearn differences)- 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.