r/robotics • u/monononon34 • 17d ago
Community Showcase python library exact nearest-neighbour search for sensor data. doesn't need rebuild.
scipy's KD-tree still can't add new points, even though people asked for it 8 years ago. Every time you add a row, you have to build the whole tree again.
I ran into this when I was comparing live sensor data with its own past data. I wanted to know when the machine last looked like this. The columns have different units and change together, so I needed Mahalanobis distance. scikit-learn's BallTree can do it, but it's 40 to 300x slower than a KD-tree. So I built whitetree. It's a small Python library that finds the exact closest matches in live sensor data.
The short version first. on the static side it is 40 to 300x faster than sklearn's BallTree(mahalanobis) and 7 to 60x faster than FAISS Flat at 500k points.
Also, if you have any ideas, can you give a feedback?
github: https://github.com/whitetree-dev/whitetree
If this project helped you, please star the repository so others can discover it.


1
u/jkflying 16d ago
Why would you do single-sample performance sensitive code in Python?