One simple improvement would be to precompute the k nearest neighbors for each region based on region centers and then do comparisons only over those neighbors, under the (correct) assumption that valid merges will be local.
cc @jwittenbach @j-friedrich might be interested in working on it
A generic greedy merging method was added in https://github.com/thunder-project/thunder-extraction/commit/aecd49348540e3b92def4e443f7d2551aa1dbb2a but the performance is quite poor in practice, sometimes taking longer than the initial fitting itself! We should find an implementation that doesn't require
n^2
region comparisons.One simple improvement would be to precompute the
k
nearest neighbors for each region based on region centers and then do comparisons only over those neighbors, under the (correct) assumption that valid merges will be local.cc @jwittenbach @j-friedrich might be interested in working on it