-
Notifications
You must be signed in to change notification settings - Fork 2
Description
The current coupling_coeffs relies on the input ll and nn. Ideally, they can be cached to avoid repeated calculations when constructing a linear model (or more generally, an NN). However, when doing the caching, some of the ll and nn's will return exactly the same results, as such, not all of them need to be computed.
One illustrative example:
For ll_1 = [1,1,1,2,2], nn_1 = [1,1,2,2,3] and ll_2 = [1,1,1,2,2], nn_2 = [3,3,4,5,6], the output coupling_coeffs(ll_i,nn_i,K) should be exactly the same, for arbitrary K.
Actually, the coupling_coeff only needs to know the ll blocks, [ [1,1], [1], [2], [2] ]. If the two sets of ll and nn's give the same ll blocks, the code should be able to refer to the already cached value to avoid duplication.
Given that the computation of the coupling coefficients in this package is now reasonably fast, this can be well redundant. But if we go to a higher correlation order at some point, this may be something worth considering.