def samples(self, gp, Y_metadata):
N1, N2 = gp.shape<EOL>Ysim = np.zeros((N1,N2))<EOL>ind = Y_metadata['<STR_LIT>'].flatten()<EOL>for j in np.unique(ind):<EOL><INDENT>flt = ind==j<EOL>gp_filtered = gp[flt,:]<EOL>n1 = gp_filtered.shape[<NUM_LIT:0>]<EOL>lik = self.likelihoods_list[j]<EOL>_ysim = np.array([np.random.normal(lik.gp_link.transf(gpj), scale=np.sqrt(lik.variance), size=<NUM_LIT:1>) for gpj in gp_filtered.flatten()])<EOL>Ysim[flt,:] = _ysim.reshape(n1,N2)<EOL><DEDENT>return Ysim<EOL>
Returns a set of samples of observations based on a given value of the latent variable.

:param gp: latent variable