更新时间:2023-10-06 18:20:34
You might be interested in the clone
function.
sklearn.base.clone(estimator,*,safe = True)[源代码]
sklearn.base.clone(estimator, *, safe=True)[source]
使用相同的参数构造一个新的不拟合估计量.克隆可以在估算器中对模型进行深层复制,而无需实际复制附加数据.它会产生一个新的估计器,该估计器具有未在任何数据上拟合的相同参数.
Constructs a new unfitted estimator with the same parameters. Clone does a deep copy of the model in an estimator without actually copying attached data. It yields a new estimator with the same parameters that has not been fitted on any data.
sklearn.base导入克隆中的
from sklearn.base import clone
model = LogisticRegression()
new_model = clone(model)