Open krivit opened 5 months ago
I was just thinking the other day about our ergm manuscript, part 2. Maybe it's a good idea to add material on RLEBDM-based TNT and finally ship it out to a more computational (as opposed to software-oriented) journal. There's no way I could work on this prior to mid-April but maybe after that point...
I'll do some quick tests on blocks with inhomogeneous densities, and if those don't show a benefit for blockdiagTNT
, I might deprecate it or see if there are any optimisations to be made.
But yes, it would be good to get that paper out.
Agreed regarding the paper. But why deprecate blockdiagTNT
? It seems presumptuous to think that a few tests mean that it's of no use in any situation.
Like everything else, it adds to compile time and has to be maintained. It also has to be prioritised against other proposals that implement the DyadGen API (and can thus handle any dyad-independent constraint).
Also, I've just checked, and both proposals TNT-propose both edges and dyads uniformly. That is, the probability that the selected edge/dyad is from a given block is the proportion out of total edges/dyads found in that block. There might be some benefit to selecting in proportion to some other function of block size, if that were to be implemented.
On the other hand, it looks like at the moment blockdiagTNT uses a bisection algorithm to select dyads at random, which is O(log(B)), whereas RLEBDM TNT uses rejection sampling, which is close to O(1) if the largest block isn't that much larger than the rest.
I suppose we could see if blockdiagTNT is faster with rejection sampling or Walker's Alias or similar.
Based on benchmarks, it seems that net of initialisation, RLEBDM-based TNT is at least as fast as block-diagonal TNT:
Created on 2024-02-20 with reprex v2.1.0
Created on 2024-02-20 with reprex v2.1.0
The dependence factors are about the same, at least if the blocks' densities are homogeneous:
Created on 2024-02-20 with reprex v2.1.0