chapter eleven

11 Applications of Nearest Neighbors Search

 

This chapter covers

  • Designing a solution for the “closest hub” problem using NN search
  • Adding filtering to NN search to support business logic and dynamic supply
  • Dealing with faulty networks and failure, and deploying to the real world
  • Applying NN search to other domain like physics and computer graphics
  • Introducing clustering

It’s time to harvest what we seeded, and to start solving the problems we have described in the last few chapters. As always, after a deep dive in theory, we try to give you a “real-life” angle, and in this chapter, we will incrementally build a solution for the “closest hub” problem, one that keeps into account many of the issues a real application would face. But do not be mistaken: we can’t tackle all the possible issues here, and this doesn’t aim to be an exhaustive description of all the possible problems you would face, neither it is  a runbook about how to operate your e-commerce application: only practice, rolling up your sleeves and getting burned while trying, can teach you that. What you can find in this chapter, besides a few examples of real-world technical challenges, is a hands-on example of the analysis process that brings you from a solution “on paper” for your use case, to a working application coping with the complex facets of reality.

11.1  An Application: Find Nearest Hub

11.1.1    Sketching a Solution

11.1.2    Trouble in Paradise

11.2  Centralized Application

11.2.1    Filtering Points

11.2.2    Complex Decisions

11.3  Moving to a Distributed Application

11.3.1    Issues Handling HTTP Communication

11.3.2    Keeping the Inventory in Sync

11.3.3    Lessons Learned

11.4  Other Applications

11.4.1    Color reduction

11.4.2    Particle Interaction

11.4.3    Multidimensional DB queries optimization

11.4.4    Clustering

11.5  Summary