![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1213263/image.gif)
- The first layer computes distances from the input vector to the training input vectors and produces a vector whose elements indicate how close the input is to a training input. (When you talk about classification between similar looking images, calculation of this distance is an important aspect)
- The second layer sums these contributions for each class of inputs to produce as its net output a vector of probabilities.
- Finally, a compete transfer function on the output of the second layer picks the maximum of these probabilities, and produces a 1 for that class and a 0 for the other classes.