ML Basics: K Nearest Neighbors in Ruby
thagomizer.com
thagomizer.com
When Cover & Hart proved that the error for k-NN classification is no worse than twice the Bayes (optimal) error, "machine learning" as a phrase had not yet been observed in the wild.
http://ieeexplore.ieee.org/document/1053964/
EE, CS, stats -- these are your fundamentals...
Know a good reading on this?
I.e. expose the underlying low rank of nearly any huge sparse data matrix with an SVD or NMF. Enable fast recovery with a shitty (CS-wise) hash function. Recover most of the information about an observation's neighbors in a fraction of the time taken by many other approaches.
What's popular for ML benchmarking these days is not necessarily the same as what's needed for a specific application. It's a useful proof to keep in mind before prematurely optimizing with overly complicated approaches.
IMHO the reason Machine Learning is NOT Stats or Information theory because these beautiful fundamental result were found to be futile in practice.
You could be using R or MATLAB certainly, there are still choices in this space
NB. naive k-nearest neighbors in J
dist =: [:%:[:|[:+/(*:@:-) NB. dyad takes two vectors, returns euclidean distance
data =: 1 2 3,2 2 3,2 3 3,1 2 3,:2 3 4
query =: 1 2 3
k =: 3
k {."1 /:"1 query&dist"1 dataAnd it's cousin KD-tree: https://github.com/axiomzen/look-alike
[1] http://quipu-strands.blogspot.com/2014/08/knn-classifier-in-...