I already asked a question related to this topic in this forum. I am implementing the stickbreaking construction of the Indian buffet process. I have a couple of problems regarding the implementation and I will appreciate if somebody can explain solutions for them:

I use the adaptive rejection sampling (ARS) to sample the stick lengths mu(k) for sampling new features (k), using equation 25 of above paper. The log function that I feed into the ARS is:
cdef double muARS(double x, double alpha, long N): #equation 25 Teh, Gorur, Ghahramani 2007 #Nonparametric Bayesian Discrete Latent Variable Models for Unsupervised Learning Dilan GĂ¶rĂĽrsimplification using B.16 equation cdef double val = <double>N*log(1x)log(x) return val cdef double primeMuARS(double x, double alpha, long N): #the derivative of quation 25 Teh, Gorur, Ghahramani 2007 cdef double val = 1/x  <double>N/(1x) return val def NewMuARS(int ns, int m, double emax, np.ndarray[ndim=1, dtype=np.float64_t] x, np.ndarray[ndim=1, dtype=np.float64_t] hx, np.ndarray[ndim=1, dtype=np.float64_t] hpx, int num, double alpha, long N): #calling the adaptive rejection sampler cdef double xlb = 0.0 cdef double xub = 0 cdef int lb= 1 cdef int ub= 0 wrap_f=make_wrapper(muARS) wrap_fprime=make_wrapper(primeMuARS) return py_ars(ns, m, emax, x, hx, hpx, num, wrap_f,wrap_fprime, alpha, xlb, xub, lb, ub, N) cdef double mu_new_features_update( double mu_prev, double alpha, long N): #equation 25 Teh et al. 2007 (Stickbreaking construction for the IBP) cdef: double mu int ns = 100 int m = 2 double emax= 64 np.ndarray[FTYPE_t, ndim=1, mode='c'] x = np.zeros(2, float) np.ndarray[FTYPE_t, ndim=1, mode='c'] hx = np.zeros(2, float) np.ndarray[FTYPE_t, ndim=1, mode='c'] hpx = np.zeros(2, float) x[0] = 0.1 x[1] = 0.98 hx[0] = muARS(x[0], alpha, N) hx[1] = muARS(x[1], alpha, N) hpx[0] = primeMuARS(x[0], alpha, N) hpx[1] = primeMuARS(x[1], alpha, N) while True: mu = NewMuARS(ns, m, emax, x, hx, hpx, 1, alpha, N)[0] if ( 0 <= mu <= mu_prev): break return mu
when the mu_{previous} is very small (e.g. 1e9
), the mu_new_features_update
tends to gets stuck in sampling small sticksizes. How can I avoid this problem?

Since the stickbreaking implementation is given in order to deal with nonconjugacy in the model, I am wondering what would happen if someone uses the stickbreaking IBP prior to testing it on the case that there is a conjugacy and some public codes are available such as the linearGaussian infinite latent feature model to examine the performances of them?

In the algorithm 15 of this thesis, it is mentioned to â€śSample parameters for the new represented features from the priorâ€ť. Does it refer to using the Bernoulli prior to sample
Z
values for the new stick sizes or it refers to other free parameters in the model?
Thanks.