# k近邻

主要了解距离的概念，计算出距离最近的k个点，其类别最大的那个作为本样本预测的类

* 距离评价参考：[距离评价](/pytorch/ji-suan-ji/ml/wen-da/ping-jia-zhi-biao.md)
* 寻找最近的k个点主要用的kdtree：[kdtree](/pytorch/ji-suan-ji/ml/kdtree.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://im-qianuxn.gitbook.io/pytorch/ji-suan-ji/ml/3-k-jin-ling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
