我想知道Python库或Tensorflow库中提供了哪些解决方案来通过属性重要性查找最近邻。 在KDTree中,库属性的重要性是相同的。你知道吗
# KDTree
import numpy as np
from sklearn.neighbors import KDTree
# Neighbors and Neighbor
neighbors = np.array([[0, 1, 0, 1],
[1, 2, 1, 2],
[2, 1, 1, 1],
[1, 0, 0, 0],
[1, 2, 0, 2],
[2, 2, 2, 2],
[1, 0, 0, 1]])
neighbor = np.array([[1, 1, 0, 1]])
tree = KDTree(neighbors, leaf_size=2)
distance, ind = tree.query(neighbor, k=7)
为了明确我要找的是什么,我开发了以下减半区间算法来计算最近邻的重要性从左到右递减的属性。第一个属性是最重要的,最后一个属性是最不重要的。 https://github.com/itsergiu/Nearest-Neighbor-by-Attribute-Importance
目前没有回答
相关问题 更多 >
编程相关推荐