K-nearest neighbor

K-nearest neighbor also known as KNN is one of the simplest forms of supervised ML algorithm that is used for both classification and regression problems. KNN is assumed to be a nonparametric algorithm which means no assumptions are made about the underlying data (Cover & Hart, 1967). The KNN algorithm works based on the basis of similar proximity using distance calculations. The following steps are used when developing a KNN model:
  • 1) Determine the number of nearest neighbors also known as K. For instance, if K=2, two of the closest points based on distance calculation will be chosen to determine where an instance will be assigned (in a classification problem). Selecting K can be challenging in a KNN algorithm. Choosing a small ...

Get Machine Learning Guide for Oil and Gas Using Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.