当前位置:网站首页>机器学习面试准备(一)KNN
机器学习面试准备(一)KNN
2022-06-30 09:48:00 【开始学AI】
目录
一、简述一下KNN算法的原理?
KNN(K-Nearest Neighbor)是一种基本的分类与回归方法,给定一个训练数据集,对于新的输入实例,在数据集中找到与该实例的最邻近的K个实例,如果这K个实例的多数属于某个类,就把该输入实例归为这一类。
KNN不具备显示的学习过程,实际上是利用训练数据集对特征空间进行划分,并作为其分类的模型。

二、KNN算法的三要素
距离度量:一般采用LP距离。(P=1,曼哈顿距离;P=2,欧氏距离;P=∞,切比雪夫距离)
K值选择:一般选取一个比较小的数,通常选择交叉验证的方法来选取最佳的K值。
分类决策规则:一般采用多数表决规则
三、如何理解K值的选择
如果K值选择较小,就相当于用较小领域中的训练实例去预测,“学习”的近似误差会减小,但估计误差会增大,如果邻近的点是噪声,预测就会出错。另外,K值的减小意味着整体模型变得复杂,容易发生过拟合。
如果K值选择较大,就相当于用较大领域中的训练实例去预测,学习的估计误差会减小,近似误差会增大,此时与输入实例较远(不相似的)实例也会对预测起作用,使预测发生错误,K值增大意味着整体的模型变得简单。
在应用中,一般选取一个比较小的数,通常选择交叉验证的方法来选取最佳的K值。
四、kd树是什么及其作用?
KNN最简单的实现方法是线性扫描,因为要对每个实例计算距离,所以当训练集很大,训练实例维度很高,计算会非常耗时。为了提高KNN搜索的效率,可以采用kd树来存储数据

五、KNN的优缺点

参考:
《统计学习方法》
边栏推荐
- 马斯克推特粉丝过亿了,但他在线失联已一周
- 2022第六季完美童模 托克逊赛区 决赛圆满落幕
- The rising star of Goldshell STC box
- [AGC] build service 3- authentication service example
- MIT-6874-Deep Learning in the Life Sciences Week6
- Yixian e - commerce publie un rapport trimestriel: adhérer à la R & D et à l’investissement de la marque, réaliser un développement durable et de haute qualité
- 1033 To Fill or Not to Fill
- Input limit input
- ArcGIS Pro + PS 矢量化用地规划图
- [ark UI] implementation of the startup page of harmoniyos ETS
猜你喜欢

2022 Season 6 perfect children's model toxon division finals came to a successful conclusion

Get through the supply chain Shenzhen gift show helps cross-border e-commerce find ways to break the situation

Oracle creates a stored procedure successfully, but the compilation fails

MySQL advanced SQL statement of database (1)

Detailed explanation of commissioning methods and techniques

Magnetic levitation 3D lamp

unable to convert expression into double array

IPhone address book import into Excel

‘Failed to fetch current robot state‘ when using the ‘plan_ kinematic_ path‘ service #868

Test memory read rate
随机推荐
What is the real performance of CK5, the king machine of CKB?
苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...
train_de.py: error: argument --save_steps: invalid int value: ‘$[$[889580/128/4]*10/2]‘
Xinguan has no lover, and all the people benefit from loving deeds to warm the world -- donation to the public welfare action of Shangqiu children's welfare home
那个程序员,被打了。
Test memory read rate
Curl --- the request fails when the post request parameter is too long (more than 1024b)
Ant s19xp appeared in 140t, why is it called the computing power ceiling by the world
打通供应链 深圳礼品展助跨境电商寻破局之道
AttributeError: ‘Version‘ object has no attribute ‘major‘
Go -- standard library sort package
ModuleNotFoundError: No module named ‘_swigfaiss‘
Arm新CPU性能提升22%,最高可组合12核,GPU首配硬件光追,网友:跟苹果的差距越来越大了...
6.Redis新数据类型
Detailed explanation of SolidWorks mass characteristics (inertia tensor, moment of inertia, inertia spindle)
戴森设计大奖,以可持续化设计改变世界
mysql数据库基础:存储过程和函数
Guolin was crowned the third place of global popularity of perfect master in the third quarter of 2022
SolidWorks质量特性详解(惯性张量、转动惯量、惯性主轴)
GeoffreyHinton:我的五十年深度学习生涯与研究心法