KD Nearest Neighbor implemented in Ruby using KD-Tree