Skip to content

Commit

Permalink
create copies of loss_args
Browse files Browse the repository at this point in the history
  • Loading branch information
arminwitte committed Sep 15, 2023
1 parent 99be4c8 commit 2a92983
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions binarybeech/attributehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def split(self, df):
n = [len(df_.index) for df_ in split_df]

loss_args = {key: self.algorithm_kwargs[key] for key in ["lambda_l1", "lambda_l2"]}
loss_args = [loss_args]*2
loss_args = [loss_args.copy(), loss_args.copy()]
if "__weights__" in df:
for i, df_ in enumerate(split_df):
loss_args[i]["weights"] = df_["__weights__"].values
Expand Down Expand Up @@ -166,7 +166,7 @@ def fun(x):
return np.Inf

loss_args = {key: self.algorithm_kwargs[key] for key in ["lambda_l1", "lambda_l2"]}
loss_args = [loss_args]*2
loss_args = [loss_args.copy(), loss_args.copy()]
if "__weights__" in df:
for i, df_ in enumerate(split_df):
loss_args[i]["weights"] = df_["__weights__"].values
Expand Down Expand Up @@ -220,7 +220,7 @@ def split(self, df):
n = [len(df_.index) for df_ in self.split_df]

loss_args = {key: self.algorithm_kwargs[key] for key in ["lambda_l1", "lambda_l2"]}
loss_args = [loss_args]*2
loss_args = [loss_args.copy(), loss_args.copy()]
if "__weights__" in df:
for i, df_ in enumerate(self.split_df):
loss_args[i]["weights"] = df_["__weights__"].values
Expand Down Expand Up @@ -305,7 +305,7 @@ def fun(x):


loss_args = {key: self.algorithm_kwargs[key] for key in ["lambda_l1", "lambda_l2"]}
loss_args = [loss_args]*2
loss_args = [loss_args.copy(), loss_args.copy()]
if "__weights__" in df:
for i, df_ in enumerate(split_df):
loss_args[i]["weights"] = df_["__weights__"].values
Expand Down
1 change: 1 addition & 0 deletions tests/test_datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def test_datamanager_info():
assert ah == ["default", "clustering"]
assert m == [
"regression",
"regression:regularized",
"classification:gini",
"classification:entropy",
"logistic",
Expand Down

0 comments on commit 2a92983

Please sign in to comment.