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:
A new data set is formed by copying n copies of the new data first;
The distance between the new data set and the original data set is calculated line by row;
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