I am new in ML and I am a little confused here in the book "Building Machine Learning Systems with Python"

enter image description here

Since you may give different test data, how can you "index these at learning time"?


1 Answer 1


I think it refers to Spatial indexing (or Space partitioning) which are methods used to represent spatial data sets (such points clouds) in order to optimize spatial queries (i.e., optimize the time it takes to find the NN of new_example in your case). The use of kd-trees is one of these methods. The kd-tree can be computed during the learning step and the NN search time is reduced in the classification step.

I am not an expert in this but you can read a bit about it on Wikipedia and use the references listed there to go further:

https://en.wikipedia.org/wiki/Nearest_neighbor_search https://en.wikipedia.org/wiki/Spatial_database#Spatial_index


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.