- Machine Learning for OpenCV
- Michael Beyeler
- 174字
- 2021-07-02 19:47:22
Understanding the k-NN algorithm
The k-NN algorithm is arguably one of the simplest machine learning algorithms. The reason for this is that we basically only need to store the training dataset. Then, in order to make a prediction for a new data point, we only need to find the closest data point in the training dataset-its nearest neighbor.
In a nutshell, the k-NN algorithm argues that a data point probably belongs to the same class as its neighbors. Think about it: if our neighbor is a Reds fan, we're probably Reds fans, too; otherwise we would have moved away a long time ago. The same can be said for the Blues.
Of course, some neighborhoods might be a little more complicated. In this case, we would not just consider our closest neighbor (where k=1), but instead our k nearest neighbors. To stick with our example as mentioned earlier, if we were Reds fans, we probably wouldn't move into a neighborhood where the majority of people are Blues fans.
That's all there is to it.
- Advanced Machine Learning with Python
- Spring 5企業(yè)級(jí)開發(fā)實(shí)戰(zhàn)
- 大學(xué)計(jì)算機(jī)應(yīng)用基礎(chǔ)實(shí)踐教程
- arc42 by Example
- 程序員面試筆試寶典
- Spring Boot+Spring Cloud+Vue+Element項(xiàng)目實(shí)戰(zhàn):手把手教你開發(fā)權(quán)限管理系統(tǒng)
- 新手學(xué)Visual C# 2008程序設(shè)計(jì)
- JSP開發(fā)案例教程
- Microsoft System Center Orchestrator 2012 R2 Essentials
- Mastering Android Development with Kotlin
- Learning Laravel's Eloquent
- ASP.NET Core 2 Fundamentals
- Advanced Express Web Application Development
- 匯編語言編程基礎(chǔ):基于LoongArch
- INSTANT Apache ServiceMix How-to