KNN (k nearest neighbor, K-nearestneighbor) algorithm for machine learning ten algorithms

Source: Internet
Author: User
KNN algorithm of ten Algorithms for machine learning

The previous period of time has been engaged in tkinter, machine learning wasted a while. Now want to re-write one, found a lot of problems, but eventually solved. We hope to make progress together with you.

Gossip less, get to the point.

KNN algorithm, also called nearest neighbor algorithm, is a classification algorithm.

The basic idea of the algorithm: Assume that there is already a data set, the dataset has multiple numeric attributes and a label attribute, enter a new data, the label of the novelty data.

The steps are as follows:

  1. A new data set is formed by copying n copies of the new data first;

  2. The distance between the new data set and the original data set is calculated line by row;

  3. After sorting by distance length, the first k data in the statistics, the label appears the most times, the new data is labeled which label.

The algorithm is as follows:

KNN (k nearest neighbor, K-nearestneighbor) algorithm for machine learning ten algorithms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.