def posterior_inf(self, X=None, posterior=None):
if X is None:<EOL><INDENT>try:<EOL><INDENT>X = self._highest_parent_.X<EOL><DEDENT>except NameError:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT><DEDENT>if posterior is None:<EOL><INDENT>try:<EOL><INDENT>posterior = self._highest_parent_.posterior<EOL><DEDENT>except NameError:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT><DEDENT>phi_alpha = self.phi(X) * self.variance<EOL>return (phi_alpha).T.dot(posterior.woodbury_vector), (np.eye(phi_alpha.shape[<NUM_LIT:1>])*self.variance - mdot(phi_alpha.T, posterior.woodbury_inv, phi_alpha))<EOL>
Do the posterior inference on the parameters given this kernels functions
and the model posterior, which has to be a GPy posterior, usually found at m.posterior, if m is a GPy model.
If not given we search for the the highest parent to be a model, containing the posterior, and for X accordingly.