|
31 | 31 |
|
32 | 32 |
|
33 | 33 | def clone(estimator, *, safe=True):
|
34 |
| - """Constructs a new unfitted estimator with the same parameters. |
| 34 | + """Construct a new unfitted estimator with the same parameters. |
35 | 35 |
|
36 | 36 | Clone does a deep copy of the model in an estimator
|
37 |
| - without actually copying attached data. It yields a new estimator |
| 37 | + without actually copying attached data. It returns a new estimator |
38 | 38 | with the same parameters that has not been fitted on any data.
|
39 | 39 |
|
40 |
| - If the estimator's `random_state` parameter is an integer (or if the |
41 |
| - estimator doesn't have a `random_state` parameter), an *exact clone* is |
42 |
| - returned: the clone and the original estimator will give the exact same |
43 |
| - results. Otherwise, *statistical clone* is returned: the clone might |
44 |
| - yield different results from the original estimator. More details can be |
45 |
| - found in :ref:`randomness`. |
46 |
| -
|
47 | 40 | Parameters
|
48 | 41 | ----------
|
49 | 42 | estimator : {list, tuple, set} of estimator instance or a single \
|
50 | 43 | estimator instance
|
51 | 44 | The estimator or group of estimators to be cloned.
|
52 |
| -
|
53 | 45 | safe : bool, default=True
|
54 | 46 | If safe is False, clone will fall back to a deep copy on objects
|
55 | 47 | that are not estimators.
|
56 | 48 |
|
| 49 | + Returns |
| 50 | + ------- |
| 51 | + estimator : object |
| 52 | + The deep copy of the input, an estimator if input is an estimator. |
| 53 | +
|
| 54 | + Notes |
| 55 | + ----- |
| 56 | + If the estimator's `random_state` parameter is an integer (or if the |
| 57 | + estimator doesn't have a `random_state` parameter), an *exact clone* is |
| 58 | + returned: the clone and the original estimator will give the exact same |
| 59 | + results. Otherwise, *statistical clone* is returned: the clone might |
| 60 | + return different results from the original estimator. More details can be |
| 61 | + found in :ref:`randomness`. |
57 | 62 | """
|
58 | 63 | estimator_type = type(estimator)
|
59 | 64 | # XXX: not handling dictionaries
|
|
0 commit comments