def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None):
assert mean_function is None, "<STR_LIT>"<EOL>K = kern.K(X)<EOL>if self.bad_fhat or self.first_run:<EOL><INDENT>Ki_f_init = np.zeros_like(Y)<EOL>self.first_run = False<EOL><DEDENT>else:<EOL><INDENT>Ki_f_init = self._previous_Ki_fhat<EOL><DEDENT>Ki_f_init = np.zeros_like(Y)<EOL>f_hat, Ki_fhat = self.rasm_mode(K, Y, likelihood, Ki_f_init, Y_metadata=Y_metadata)<EOL>log_marginal, woodbury_inv, dL_dK, dL_dthetaL = self.mode_computations(f_hat, Ki_fhat, K, Y, likelihood, kern, Y_metadata)<EOL>self._previous_Ki_fhat = Ki_fhat.copy()<EOL>return Posterior(woodbury_vector=Ki_fhat, woodbury_inv=woodbury_inv, K=K), log_marginal, {'<STR_LIT>':dL_dK, '<STR_LIT>':dL_dthetaL}<EOL>
Returns a Posterior class containing essential quantities of the posterior