Thank you very much for writing. Well, there are multiple algorithms for machine learning, some of them are expensives in memory and time. KNN is an algorithm that use a lot of memory in the microcontroller, but don't create a model of the data base, but we can use this for classify data.
My idea is program this algorithm in a microcontroller for has a plataform for classify objects (sensors play a importan rol) maybe using an arduino board like an agent only for classify data.
I think that we can use a similar approach for image processing in arduino. In my thesis work, I developed an algorithm for image segmentation using the "KNN approach". Is simple and I think that could works in arduino.
In the attached file, you can found the source code, sorry for write the functions in spanish, I will translate this.
In the attached you can see a .rar file, this rar has 2 folders. In knnarduino3 you can found a simple implementation of the algorithm, for get a class from data you must send "{0.1, 0.2, 0.3, 0.4}", this is the format. You can see more data in iris.xlsx. The k parameter of the algorithm is 11, and you can change this for get better or worst classification results.
In the other hand, for knnarduino4, is a program that gets the best "k" parameter. This function computes the "recall" result for evaluating a "k". A recall near of 100% is desired. A k with best recall is returned in the serial interface. This part of the algorithm can be understood like "training-part" is a little ambicious but is only for naming.
Please be free for write me for any doubt.
Use the code for your projects and send me bugs and errors for improving.
Regards.