Skip to content

Commit

Permalink
Made sure that all dictionary keywords for class initializations are …
Browse files Browse the repository at this point in the history
…COPIED so that defaults don't get overwritten...
  • Loading branch information
ejohnson643 committed Oct 29, 2021
1 parent ffb7073 commit a0c98a1
Show file tree
Hide file tree
Showing 6 changed files with 977 additions and 4 deletions.
6 changes: 3 additions & 3 deletions EMBEDR/affinity.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self,
random_state=1,
verbose=1):

self.kernel_params = kernel_params
self.kernel_params = kernel_params.copy()

self.symmetrize = bool(symmetrize)

Expand Down Expand Up @@ -371,11 +371,11 @@ def _initialize_affinity_matrix(X,
tmp_kNN_params = {'n_neighbors': n_neighbors}
tmp_kNN_params.update(kNN_params)

aff_obj = aff_class(kernel_params=kernel_params,
aff_obj = aff_class(kernel_params=kernel_params.copy(),
symmetrize=symmetrize,
normalization=normalization,
precomputed=precomputed,
kNN_params=tmp_kNN_params,
kNN_params=tmp_kNN_params.copy(),
n_jobs=n_jobs,
random_state=random_state,
verbose=verbose,
Expand Down
5 changes: 4 additions & 1 deletion EMBEDR/nearest_neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ def __init__(self,
**kwargs):

self.metric = self._check_metric(metric)
self.metric_params = metric_params
if metric_params is not None:
self.metric_params = metric_params.copy()
else:
self.metric_params = None
self.n_jobs = int(n_jobs)
self.random_state = check_random_state(random_state)
self.verbose = float(verbose)
Expand Down
Loading

0 comments on commit a0c98a1

Please sign in to comment.