(bytespace-nearest-greymap bytespace greymap)
This procedure searches for the nearest greymap in the specified bytespace by naive brute force. The search space is divided internally in 16 parts and 16 threads are working in parallel.
The distance metric in effect is the Manhattan metric (L1 norm). The resolution of the query greymap must match the number of dimensions of the bytespace, otherwise an error is signalled. If the bytespace contains no points (being greyscale images), #f is returned.
For classification purposes, the associated value is returned in the ocol (originating column) value slot in the greymap.
The classification of the MNIST testing data set with no preprocessing achieves an error rate of 3.68% with this procedure (KNN (L1) with K==1). Here’s the reference to the original MNIST data set: yann.lecun.com/exdb/mnist/.
The guaranteed nearest greymap is returned (or #f is the bytespace contains no elements).
> (define q (greymap-readpng "testing/7/2278.png")) q > (bytespace-nearest-greymap bytespace q) #<greymap orow:7 ocol:-1 xres:-1 yres:-1 w:28 h:28> >