File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def similarity_search(
44
44
dataset : np .ndarray ,
45
45
value_array : np .ndarray ,
46
46
distance_func : DistanceFunction = euclidean ,
47
- k : int = 1
47
+ k : int = 1 ,
48
48
) -> List [List [Union [List [float ], float ]]]:
49
49
"""
50
50
:param dataset: Set containing the vectors. Should be ndarray.
@@ -143,10 +143,7 @@ def similarity_search(
143
143
for value in value_array :
144
144
distances = [distance_func (value , data_point ) for data_point in dataset ]
145
145
nearest_indices = np .argsort (distances )[:k ]
146
- answer .append ([
147
- [dataset [i ].tolist (), distances [i ]]
148
- for i in nearest_indices
149
- ])
146
+ answer .append ([[dataset [i ].tolist (), distances [i ]] for i in nearest_indices ])
150
147
151
148
return answer [0 ] if len (answer ) == 1 else answer
152
149
You can’t perform that action at this time.
0 commit comments