@@ -131,7 +131,7 @@ def subsampled_neighbors(self, X):
131
131
the distance between them.
132
132
133
133
random_state : int or numpy.RandomState, default=None
134
- A pseudo random number generator object or a seed for it if int.
134
+ A pseudo random number generator object or a seed for it if int.
135
135
See :term: `Glossary <random_state>`.
136
136
137
137
Returns
@@ -152,12 +152,13 @@ def subsampled_neighbors(self, X):
152
152
# Sample edges
153
153
rows = np .repeat (np .arange (n ), n_neighbors )
154
154
cols = self .random_state_ .randint (self .n_train_ , size = n * n_neighbors )
155
-
155
+
156
156
# No edges sampled
157
157
if n_neighbors < 1 :
158
158
return csr_matrix ((n , self .n_train_ ))
159
159
160
- distances = paired_distances (X [rows ], self .fit_X_ [cols ], metric = self .metric )
160
+ distances = paired_distances (X [rows ], self .fit_X_ [cols ],
161
+ metric = self .metric )
161
162
162
163
# Keep only neighbors within epsilon-neighborhood
163
164
if self .eps is not None :
@@ -177,7 +178,7 @@ def subsampled_neighbors(self, X):
177
178
cols [start :stop ] = cols [start :stop ][dist_order ]
178
179
179
180
# Sort column indices and label duplicates
180
- # When consecutive elements in sorted array are equal,
181
+ # When consecutive elements in sorted array are equal,
181
182
# it means there is a duplicate
182
183
col_order = np .argsort (cols [start :stop ], kind = 'mergesort' )
183
184
cols_tmp = cols [start :stop ][col_order ]
@@ -192,7 +193,6 @@ def subsampled_neighbors(self, X):
192
193
193
194
neighborhood = csr_matrix ((distances , cols , indptr ),
194
195
shape = (n , self .n_train_ ))
195
-
196
196
return neighborhood
197
197
198
198
def _more_tags (self ):
0 commit comments