def helper_predict_with_model(self, Xgrid, plot_raw, apply_link, percentiles, which_data_ycols, predict_kw, samples=<NUM_LIT:0>):
<EOL>if predict_kw is None:<EOL><INDENT>predict_kw = {}<EOL><DEDENT>if '<STR_LIT>' not in predict_kw:<EOL><INDENT>if plot_raw:<EOL><INDENT>from ...likelihoods import Gaussian<EOL>from ...likelihoods.link_functions import Identity<EOL>lik = Gaussian(Identity(), <NUM_LIT>) <EOL><DEDENT>else:<EOL><INDENT>lik = None<EOL><DEDENT>predict_kw['<STR_LIT>'] = lik<EOL><DEDENT>if '<STR_LIT>' not in predict_kw:<EOL><INDENT>predict_kw['<STR_LIT>'] = {}<EOL><DEDENT>if '<STR_LIT>' not in predict_kw['<STR_LIT>']:<EOL><INDENT>predict_kw['<STR_LIT>']['<STR_LIT>'] = Xgrid[:,-<NUM_LIT:1>:].astype(np.int)<EOL><DEDENT>mu, _ = self.predict(Xgrid, **predict_kw)<EOL>if percentiles is not None:<EOL><INDENT>percentiles = self.predict_quantiles(Xgrid, quantiles=percentiles, **predict_kw)<EOL><DEDENT>else: percentiles = []<EOL>if samples > <NUM_LIT:0>:<EOL><INDENT>fsamples = self.posterior_samples(Xgrid, size=samples, **predict_kw)<EOL>fsamples = fsamples[:, which_data_ycols, :]<EOL><DEDENT>else:<EOL><INDENT>fsamples = None<EOL><DEDENT>retmu = mu[:, which_data_ycols]<EOL>percs = [p[:, which_data_ycols] for p in percentiles]<EOL>if plot_raw and apply_link:<EOL><INDENT>for i in range(len(which_data_ycols)):<EOL><INDENT>retmu[:, [i]] = self.likelihood.gp_link.transf(mu[:, [i]])<EOL>for perc in percs:<EOL><INDENT>perc[:, [i]] = self.likelihood.gp_link.transf(perc[:, [i]])<EOL><DEDENT>if fsamples is not None:<EOL><INDENT>for s in range(fsamples.shape[-<NUM_LIT:1>]):<EOL><INDENT>fsamples[:, i, s] = self.likelihood.gp_link.transf(fsamples[:, i, s])<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return retmu, percs, fsamples<EOL>
Make the right decisions for prediction with a model
based on the standard arguments of plotting.

This is quite complex and will take a while to understand,
so do not change anything in here lightly!!!