Commit Graph
12863 Commits
Author SHA1 Message Date
Ryan Curtin 4db93bfa4c Refactor to use new set of rules. How many times will I restart writing this algorithm until I actually get it working well? 2015-03-12 15:42:45 -04:00
Ryan Curtin bce6482563 Slightly tighter prune. 2015-03-12 15:42:45 -04:00
Ryan Curtin aa36ea42dc Shitty implementation of Elkan-type prune. It makes things faster... a little... 2015-03-12 15:42:45 -04:00
Ryan Curtin cf56ad4a2a A start at implementing pointwise Hamerly bounds. 2015-03-12 15:42:45 -04:00
Ryan Curtin 5a4b15cf0b Remove vestigial code. After all, this code isn't generated by genetic algorithms. (Maybe it should be?) 2015-03-12 15:42:45 -04:00
Ryan Curtin 6300189ab4 Correct Pelleg-Moore prunes that finish a node. There were cases where a Pelleg-Moore prune would happen before committing the point. This is actually getting pretty fast in terms of base cases, so I am happy with that (for once). 2015-03-12 15:42:44 -04:00
Ryan Curtin b094362c2b Add some debugging output. This makes it a bit easier to figure out what is going wrong. 2015-03-12 15:42:44 -04:00
Ryan Curtin c413ad2399 Better speedups, provide more output on prunes. 2015-03-12 15:42:44 -04:00
Ryan Curtin 50d4a325c7 Remove debug output; implement Pelleg-Moore prune. Now this is faster than the regular dtkm branch. Sometimes starting over is a good thing. 2015-03-12 15:42:44 -04:00
Ryan Curtin 2633583a44 Refactor into UpdateOwner(), instead of an ugly loop at the beginning of TreeUpdate(). 2015-03-12 15:42:44 -04:00
Ryan Curtin de01b8f67a I don't think this is worth saving. It also doesn't work very well, but I learned a lot about the bookkeeping I need to do. 2015-03-12 15:42:44 -04:00
Ryan Curtin ca7b1a38ff Last changes for a little while. 2015-03-12 15:42:44 -04:00
Ryan Curtin a06391e861 Fix second bound to not be the first bound. In some situations, MinQueryNodeDistance() was equal to SecondClosestBound(). This fixes that. This also resolves an issue where SecondClosestBound() wasn't properly updated after an Elkan prune. 2015-03-12 15:42:44 -04:00
Ryan Curtin ca4066a3a8 Don't set CQN to NULL before recursing. This was an error in TreeUpdate() that caused... some problems that I'm only vaguely aware of as problems. Also refactor one of the second bound rules and comment it so that it makes some semblance of sense. 2015-03-12 15:42:44 -04:00
Ryan Curtin 87ea896277 Remove some debug output we don't need anymore. 2015-03-12 15:42:44 -04:00
Ryan Curtin b6a1c3699e Unset Owner() after failed Hamerly prune. This is better than setting it by hand when we're checking if we can prune. 2015-03-12 15:42:44 -04:00
Ryan Curtin 29136848ae Fix compilation warnings. secondClosest will eventually be removed but is commented for now. 2015-03-12 15:42:44 -04:00
Ryan Curtin 27f3a36e93 Count number of points that are Hamerly pruned. 2015-03-12 15:42:44 -04:00
Ryan Curtin eba305d23f Comment out most of the debugging output. It still shows you what's been Hamerly pruned and what hasn't, which is what's important right now. 2015-03-12 15:42:44 -04:00
Ryan Curtin 79379ee09e Um, I made it faster. We're well into the land of confusion. Confusion will reign until eventual refactoring. Hamerly prunes still don't appear to be working properly after a couple iterations. 2015-03-12 15:42:44 -04:00
Ryan Curtin 994b4858ba Remove unnecessary check for parent's SCB. There actually isn't a need to take the parent's second closest bound preferentially, and it was preventing some valid prunes. This gives a little more (but not enough) Hamerly pruning, and provides (as usual) trivial speedup---but more than none! 2015-03-12 15:42:44 -04:00
Ryan Curtin abfc0b8e4d Be more careful about when to take the last SCB. This gives a trivial speedup, but hey, speedup! Hamerly prunes are still not working properly, but I'm getting there. 2015-03-12 15:42:44 -04:00
Ryan Curtin db0d792ef8 Handle SecondClosestBound() a little better. Debugging information is still there, and it is going to need to be seriously refactored. We still don't have properly working Hamerly prunes; they go away after a couple iterations incorrectly. 2015-03-12 15:42:44 -04:00
Ryan Curtin 772dc745c4 Add debug output; don't adjust second bound. This provides another minor speedup, but this still is nowhere near as fast as it should be with a properly working Hamerly prune. 2015-03-12 15:42:44 -04:00
Ryan Curtin c83b94bc22 A first attempt at a working Hamerly prune. The bounds tighten too much and don't reset, so there's not much speedup, but it's a start. 2015-03-12 15:42:44 -04:00
Ryan Curtin 727714ea11 Avoid uninitialized owner field. 2015-03-12 15:42:44 -04:00
Ryan Curtin 96bcad550d Fix invalid memory access. 2015-03-12 15:42:44 -04:00
Ryan Curtin 83f4201766 Add second bound. 2015-03-12 15:42:44 -04:00
Ryan Curtin cd1765c30f Rename to Hamerly-type score. Because that's what it is. Although Elkan's algorithm has a type of score that's sort of like this, it's Hamerly's algorithm that only keeps track of the second-closest cluster distance, and that's what we're doing here. 2015-03-12 15:42:44 -04:00
Ryan Curtin 6ad3f73535 Oops, bad parameter name. 2015-03-12 15:42:44 -04:00
Ryan Curtin 9515f01939 New stub method for (hopefully) good Elkan prune. This allows us to prune without even needing to recurse. 2015-03-12 15:42:44 -04:00
Ryan Curtin f8a73a38ae Elkan pruning can't prune the best query node. Bugfix. Trivial slowdown. 2015-03-12 15:42:44 -04:00
Ryan Curtin dea4b29b71 Update FirstBound correctly. Trivial speedup. 2015-03-12 15:42:44 -04:00
Ryan Curtin ee7eb43f01 Set FirstBound() after the allknn. Now, checking if FirstBound() == DBL_MAX is unnecessary, although this doesn't (yet) seem to give any additional prunes. 2015-03-12 15:42:44 -04:00
Ryan Curtin fd948ea600 Fix typo, which actually gives a speedup. A fairly trivial speedup, but a speedup nonetheless. 2015-03-12 15:42:44 -04:00
Ryan Curtin f9c48d2ce6 Fix warning for unused parameter. 2015-03-12 15:42:44 -04:00
Ryan Curtin 8a76218789 Try to do an Elkan prune not at a query leaf. It doesn't seem to work right now, though. 2015-03-12 15:42:44 -04:00
Ryan Curtin 37436c33c9 Remove unnecessary check; that can never happen. 2015-03-12 15:42:44 -04:00
Ryan Curtin 393be90675 Count the base cases and scores of the kNN run. 2015-03-12 15:42:44 -04:00
Ryan Curtin 61f65523b8 Don't calculate MaxDistance() unless we have to. Fairly significant time savings on this one. 2015-03-12 15:42:44 -04:00
Ryan Curtin 4a5add507f Avoid calculating distances after an Elkan prune. Slight, nearly negligible performance gains. 2015-03-12 15:42:43 -04:00
Ryan Curtin 581a4a0dee Don't accidentally take results before finished. We have to wait until all clusters are pruned, not all except one. 2015-03-12 15:42:43 -04:00
Ryan Curtin 1072053036 This output is less useful right now. 2015-03-12 15:42:43 -04:00
Ryan Curtin e72ab4c744 Use ClosestQueryNode() not MaxQueryNodeDistance(). Eventually MaxQueryNodeDistance() will not be reset to DBL_MAX every iteration. 2015-03-12 15:42:33 -04:00
Ryan Curtin 56cbc1c3bb Some fairly serious refactoring, but it works.
There are significant optimizations to still be made, but at this point we get
some acceleration over the naive algorithm.
2015-03-12 15:42:27 -04:00
Ryan Curtin 44fa159677 Perform the top-level scoring too. 2015-03-12 15:41:12 -04:00
Ryan Curtin 6366cc9349 Fix all -Wunused-parameter. 2015-03-12 15:40:02 -04:00
Ryan Curtin 347b8c08aa Refactor to perform allknn on the clusters. This is done at the start of each iteration. This allows Elkan pruning without an additional distance calculation. 2015-03-12 15:39:29 -04:00
ryan ee45212808 Beginning to refactor dual-tree k-means. So far the Pelleg-Moore rule is properly refactored (well, sort of, at least). Try to move IterationUpdate() into DualTreeKMeans::TreeUpdate(); for now this will make the algorithm simpler: instead of updating on the fly, update after an iteration. It may make more sense to do updates on demand later, but let's make the algorithm work first... 2015-03-12 15:39:26 -04:00
ryan c63a518c8b Slight refactoring of dual-tree k-means rules.
This is an attempt to clean up this code because it quickly became unwieldy and
hard to work with.  A more modular approach could lead to a better, faster
solution.
2015-03-12 15:39:26 -04:00