CCMgen icon indicating copy to clipboard operation
CCMgen copied to clipboard

when gaps included in x_single, there is an error in sampling

Open sokrypton opened this issue 4 years ago • 0 comments

the ccmpred.parameter_handling.structured_to_linear() function linearizes x_single and x_pair. by default it is assumed that x_single is a vector of size (L,20), if the flag nogapstate=False, it's assumed x_single is (L,21).

So far so good... but then if you try sample sequences using: x = ccmpred.parameter_handling.structured_to_linear(...,nogapstate=False) ccmpred.sampling.generate_mcmc_sample(x,...)

the "x" appears to be incorrectly parsed by function, assuming x_single is (L,20), and sampling is out of wack.

Appears this assumption (N_ALPHA - 1) is hard-coded in: ccmpred/objfun/cd/cext/cd.h #define X1_INDEX(i,a) (i) * (N_ALPHA - 1) + (a) #define E1(i,a) x[X1_INDEX(i,a)]

then later in: ccmpred/objfun/cd/cext/cd.c void compute_conditional_probs(...) { int nsingle = ncol * (N_ALPHA - 1); for (a = 0; a < N_ALPHA - 1; a++) {cond_probs[a] = E1(i,a);} ... }

sokrypton avatar Jun 12 '21 22:06 sokrypton