Comments (3)
Hi sorry for the delayed response. This is an unexpected (but interesting) use-case of fast-pair! Is it possible that, without computing the mean of the two closest points, this is in fact the outcome when you remove the closest pairs? Alternatively, what happens if you remove both a and b, and then re-insert b in the iterative case?
from fastpair.
When I remove a and b and then re-insert b, it works:
The code:
fp = FastPair()
fp.build(points)
for i in range(int(len(fp) * 0.8)): # remove 80 percent of points
dist, (a, b) = fp.closest_pair()
fp -= a
fp -= b
fp += b
for p in fp:
plt.plot(p[0], p[1], "b.")
You can also try it with the notebook I shared it is pretty short. I tested this with the latest commit of this repository.
But the problem is; the algorithm should work without removing b and re-inserting b. Looks like there is a problem that may cause instability in other problems as well. I also checked the code but couldn't find it easily.
from fastpair.
Instead of removing and re-adding b, this also produces the same result:
fp._update_point(b, b)
I hope this helps.
from fastpair.
Related Issues (20)
- review README for typos
- start work on improving testing
- swap out `math`& `random` for `numpy` in tests
- remove `dist` from `__all__`? HOT 1
- explicit vs. shorthand imports HOT 1
- update random number generator in tests
- add type hints HOT 1
- beef up docstrings
- move info at top of `base.py` into `FastPair` docstring
- `initialized` via `build()`? HOT 2
- `closest_pair_divide_conquer()` method
- strange test pass & fail for `test_update_point_less_points()`
- remove `test_fastpair_pre_v010.py` when ready
- add a descriptive `__repr__()` to `FastPair`
- adding & subtracting multiple points after calling ``build()`` HOT 2
- need `return` statements in `_find_neighbor()` & `_update_point()`
- perform type testing with `mypy`
- `typing.Self` only available in Python 3.11+
- add `pytest-doctestplus` for doctest-only option
- test against both intel & apple silicon -- macOS CI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastpair.