As k-NN uses underlying patterns in the data to make predictions, prediction errors are thus telltale signs of data points that do not conform to overall trends. In fact, this approach means that any algorithm that generates a predictive model could be used to detect anomalies.

