Choosing the neighborhood size for a voting classifier
Nearest-neighbor classification retrieves k training examples by distance and votes using their labels, optionally weighting by distance.
KNeighborsClassifier in practice
One mislabeled neighbor can determine a one-neighbor vote. Larger neighborhoods dilute it but may overwhelm a small class. Validate distance scaling as well.
中文
近邻分类中 k 的大小会怎样影响决策?
近邻分类按输入距离寻找 k 个训练样本,再由其标签投票或加权投票。
KNeighborsClassifier 应用实例
一个错标邻居可能决定 k=1 的预测,扩大邻域可稀释它。邻域过大又可能掩盖稀少类别,距离尺度也需验证。