Skip to content

Commit

Permalink
use deep copy for model parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-sicho committed Jun 26, 2024
1 parent 2220998 commit 5fbba76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qsprpred/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit 5fbba76

Please sign in to comment.