spamosaic.MNN.mnn
- spamosaic.MNN.mnn(ds1, ds2, names1, names2, knn1=20, knn2=20, approx=True, metric='euclidean', way='hnsw', norm=False)[source]
Compute Mutual Nearest Neighbors (MNN) between two datasets.
- Parameters:
ds1 (np.ndarray) – First dataset (queries).
ds2 (np.ndarray) – Second dataset (references).
names1 (list of str) – Identifiers for ds1.
names2 (list of str) – Identifiers for ds2.
knn1 (int) – Number of neighbors for ds1 → ds2.
knn2 (int) – Number of neighbors for ds2 → ds1.
approx (bool, default=True) – Whether to use approximate neighbor search.
metric (str, default='euclidean') – Distance metric to use.
way (str, default='hnsw') – Method for approximate search: ‘hnsw’ or ‘annoy’.
norm (bool, default=False) – Whether to normalize data before Annoy search.
- Returns:
Set of mutual nearest neighbor pairs.
- Return type:
Set[Tuple[str, str]]