Closed jg-you closed 12 months ago
Basically I'm not sure about summing over axis=1 in the other version, but I might not be following your code. It looks like nl is already of length N, should not be summed.
I double-checked this, and the nl/ml matrices are $N \times N$ matrices where the rows are node index, and the columns are the $\ell$ value. The function sums over axis 0 to get total counts. I believe that it's correct, and I will add some unit tests when I get a chance.
https://github.com/nwlandry/modeling-and-inferring-complex-contagion/blob/a2c190997eb00702d3075a27f7f38685208c4158/src/inference.py#L160C1-L164C1
Not sure this is correct.
Shoud be $\sum\ell \log B(m\ell + a\ell, n\ell + b_\ell)$
where $a_\ell,b_ell$ are hyperparametrs. We can set them to 1 for simplicity.
Then you'd have (where
al
,bl
are N-1 length vectors, and same fornl
andml
)This is using the fact that
betaln
evaluates to an array of values of N values of the Beta function when given two arrays of length N