Skip to content

Commit

Permalink
implement fixed bandwidth mnn
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgigante committed Sep 18, 2018
1 parent 40d41da commit 5f2bd79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion graphtools/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ def __init__(self, data, sample_idx,
knn=5, beta=1, n_pca=None,
adaptive_k='sqrt',
decay=None,
bandwidth=None,
distance='euclidean',
thresh=1e-4,
n_jobs=1,
Expand All @@ -916,6 +917,7 @@ def __init__(self, data, sample_idx,
self.knn = knn
self.decay = decay
self.distance = distance
self.bandwidth = bandwidth
self.thresh = thresh
self.n_jobs = n_jobs
self.weighted_knn = self._weight_knn()
Expand Down Expand Up @@ -1043,7 +1045,7 @@ def set_params(self, **params):
"Cannot update adaptive_k. Please create a new graph")

# knn arguments
knn_kernel_args = ['knn', 'decay', 'distance', 'thresh']
knn_kernel_args = ['knn', 'decay', 'distance', 'thresh', 'bandwidth']
knn_other_args = ['n_jobs', 'random_state', 'verbose']
for arg in knn_kernel_args:
if arg in params and params[arg] != getattr(self, arg):
Expand Down Expand Up @@ -1085,6 +1087,7 @@ def build_kernel(self):
graph = Graph(data, n_pca=None,
knn=self.weighted_knn[i],
decay=self.decay,
bandwidth=self.bandwidth,
distance=self.distance,
thresh=self.thresh,
verbose=self.verbose,
Expand Down
1 change: 1 addition & 0 deletions test/test_mnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def test_set_params():
'adaptive_k': 'sqrt',
'knn': 3,
'decay': 10,
'bandwidth': None,
'distance': 'euclidean',
'thresh': 1e-4,
'n_jobs': 1
Expand Down

0 comments on commit 5f2bd79

Please sign in to comment.