def posterior_samples_f(self, X, size=<NUM_LIT:10>, full_cov=True, **predict_kwargs):
mu, var = self._raw_predict(X, full_cov=full_cov, **predict_kwargs)<EOL>if self.normalizer is not None:<EOL><INDENT>mu, var = self.normalizer.inverse_mean(mu), self.normalizer.inverse_variance(var)<EOL><DEDENT>def sim_one_dim(m, v):<EOL><INDENT>nu = self.nu + <NUM_LIT:2> + self.num_data<EOL>v = np.diag(v.flatten()) if not full_cov else v<EOL>Z = np.random.multivariate_normal(np.zeros(X.shape[<NUM_LIT:0>]), v, size).T<EOL>g = np.tile(np.random.gamma(nu / <NUM_LIT>, <NUM_LIT> / nu, size), (X.shape[<NUM_LIT:0>], <NUM_LIT:1>))<EOL>return m + Z / np.sqrt(g)<EOL><DEDENT>if self.output_dim == <NUM_LIT:1>:<EOL><INDENT>return sim_one_dim(mu, var)<EOL><DEDENT>else:<EOL><INDENT>fsim = np.empty((self.output_dim, self.num_data, size))<EOL>for d in range(self.output_dim):<EOL><INDENT>if full_cov and var.ndim == <NUM_LIT:3>:<EOL><INDENT>fsim[d] = sim_one_dim(mu[:, d], var[:, :, d])<EOL><DEDENT>elif (not full_cov) and var.ndim == <NUM_LIT:2>:<EOL><INDENT>fsim[d] = sim_one_dim(mu[:, d], var[:, d])<EOL><DEDENT>else:<EOL><INDENT>fsim[d] = sim_one_dim(mu[:, d], var)<EOL><DEDENT><DEDENT><DEDENT>return fsim<EOL>
Samples the posterior TP at the points X.

:param X: The points at which to take the samples.
:type X: np.ndarray (Nnew x self.input_dim)
:param size: the number of a posteriori samples.
:type size: int.
:param full_cov: whether to return the full covariance matrix, or just the diagonal.
:type full_cov: bool.
:returns: fsim: set of simulations
:rtype: np.ndarray (D x N x samples) (if D==1 we flatten out the first dimension)