You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
# 4.3:k-近邻算法流程
|
|
|
|
`knn`算法不需要训练模型,只是根据离样本最近的几个样本类型来判别该样本类型,所以流程非常简单:
|
|
|
|
- 1.计算出新样本与每一个样本的距离
|
|
- 2.找出距离最近的`k`个样本
|
|
- 3.根据加权投票规则得到新样本的类别 |