KNN is a non parametric method used in machine learning.
We find two knid of KNN:
KNN classifier: Used in classification problem in which the ouput is a categorical variable.
KNN regression : Used in regression problem in which the output is a numerical variable.
In the context of regression problem we indentifie the first the K (Integer) nearest training points, to the observation we want to predict its output, and next we compute the average of the value of those points. The optimal value of K depend on the "Bias-Vriance tradeoff" ( a very important concept in statistic and machine learning).