From 5fbba760e2b86aca0f6fef9f033125eb66dc8f57 Mon Sep 17 00:00:00 2001 From: martin-sicho Date: Wed, 26 Jun 2024 15:32:46 +0200 Subject: [PATCH] use deep copy for model parameters --- qsprpred/models/model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qsprpred/models/model.py b/qsprpred/models/model.py index d3408ef7..1688df2b 100644 --- a/qsprpred/models/model.py +++ b/qsprpred/models/model.py @@ -176,7 +176,7 @@ def __init__( f"Estimator will be reloaded with the new parameters " f"and will have to be re-fitted if fitted previously." ) - self.parameters = parameters + self.parameters = copy.deepcopy(parameters) self.estimator = self.loadEstimator(self.parameters) if random_state: logger.warning( @@ -185,7 +185,8 @@ def __init__( ) self.initRandomState(random_state) else: - self.parameters = parameters + # make a deep copy of the params to make sure no problems happen downstream + self.parameters = copy.deepcopy(parameters) # initialize an estimator instance with the given parameters self.alg = alg # initialize random state