def update_zeta_j_sph(curr_zeta, n, sY, slY, alpha, beta): """ Update routine for zeta on spherical data """ prop_zeta = np.empty(curr_zeta.shape) for l in range(curr_zeta.shape[0]): prop_zeta[l] = sample_alpha_1_mh_summary(curr_zeta[l], n, sY[l], slY[l], alpha[l], beta[l]) return prop_zeta
def update_zeta_j_wrapper(args): # parse arguments curr_zeta_j, n_j, Y_js, lY_js, alpha, beta, xi, tau, sigma_unity = args prop_zeta_j = np.empty(curr_zeta_j.shape) # prepare placeholders for xi, tau (with same indexing as zeta) xxi = np.ones(curr_zeta_j.shape) xta = np.ones(curr_zeta_j.shape) xxi[~sigma_unity] = xi xta[~sigma_unity] = tau # iterate through zeta sampling for i in range(curr_zeta_j.shape[0]): if sigma_unity[i]: prop_zeta_j[i] = sample_alpha_1_mh_summary( curr_zeta_j[i], n_j, Y_js[i], lY_js[i], alpha[i], beta[i], ) else: prop_zeta_j[i] = sample_alpha_k_mh_summary( curr_zeta_j[i], n_j, Y_js[i], lY_js[i], alpha[i], beta[i], xxi[i], xta[i], ) return prop_zeta_j
def update_zeta_j_wrapper(args): # parse arguments curr_zeta_j, n_j, Y_js, lY_js, alpha, beta = args prop_zeta_j = np.empty(curr_zeta_j.shape) # iterate through zeta sampling for i in range(curr_zeta_j.shape[0]): prop_zeta_j[i] = sample_alpha_1_mh_summary(curr_zeta_j[i], n_j, Y_js[i], lY_js[i], alpha[i], beta[i]) return prop_zeta_j
def sample_zeta(self, curr_zeta, rho): srho = rho.sum(axis = 0) slrho = np.log(rho).sum(axis = 0) prop_zeta = np.empty(curr_zeta.shape) for i in range(self.nCol): prop_zeta[i] = sample_alpha_1_mh_summary( curr_zeta[i], self.nDat, srho[i], slrho[i], self.priors.zeta.a, self.priors.zeta.b, ) return prop_zeta
def update_zeta_j_wrapper(args): # parse arguments curr_zeta_j, n_j, Y_js, lY_js, alpha, beta, xi, tau = args prop_zeta_j = np.empty(curr_zeta_j.shape) prop_zeta_j[0] = sample_alpha_1_mh_summary( curr_zeta_j[0], n_j, Y_js[0], lY_js[0], alpha[0], beta[0] ) for i in range(1, curr_zeta_j.shape[0]): prop_zeta_j[i] = sample_alpha_k_mh_summary( curr_zeta_j[i], n_j, Y_js[i], lY_js[i], alpha[i], beta[i], xi[i-1], tau[i-1], ) return prop_zeta_j
def update_zeta_wrapper(args): # parse arguments curr_zeta, n, Ys, lYs, alpha, beta, xi, tau = args prop_zeta = np.empty(curr_zeta.shape) prop_zeta[0] = sample_alpha_1_mh_summary( curr_zeta[0], n, Ys[0], lYs[0], alpha, beta ) for i in range(1, curr_zeta.shape[0]): prop_zeta[i] = sample_alpha_k_mh_summary( curr_zeta[i], n, Ys[i], lYs[i], alpha, beta, xi, tau, ) return prop_zeta
def sample_gamma_shape_wrapper(args): # return sample_alpha_k_mh_summary(*args) return sample_alpha_1_mh_summary(*args)