📜  无监督 knn - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:19.663000             🧑  作者: Mango

代码示例1
import numpy as np
from sklearn.neighbors import NearestNeighbors
samples = [[0, 0, 2], [1, 0, 0], [0, 0, 1]]

neigh = NearestNeighbors(2, 0.4)
neigh.fit(samples) 

neigh.kneighbors([[0, 0, 1.3]], 2, return_distance=False)