#NEWLINE# def inference( self , kern , X , likelihood , Y , mean_function = None , Y_metadata = None ) : #NEWLINE# #INDENT# '\n        Returns a Posterior class containing essential quantities of the posterior\n        ' #NEWLINE# assert ( mean_function is None ) , 'inference with a mean function not implemented' #NEWLINE# K = kern . K ( X ) #NEWLINE# if ( self . bad_fhat or self . first_run ) : #NEWLINE# #INDENT# Ki_f_init = np . zeros_like ( Y ) #NEWLINE# self . first_run = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# Ki_f_init = self . _previous_Ki_fhat #NEWLINE# #UNINDENT# Ki_f_init = np . zeros_like ( Y ) #NEWLINE# ( f_hat , Ki_fhat ) = self . rasm_mode ( K , Y , likelihood , Ki_f_init , Y_metadata = Y_metadata ) #NEWLINE# ( log_marginal , woodbury_inv , dL_dK , dL_dthetaL ) = self . mode_computations ( f_hat , Ki_fhat , K , Y , likelihood , kern , Y_metadata ) #NEWLINE# self . _previous_Ki_fhat = Ki_fhat . copy ( ) #NEWLINE# return ( Posterior ( woodbury_vector = Ki_fhat , woodbury_inv = woodbury_inv , K = K ) , log_marginal , { #NEWLINE# #INDENT# 'dL_dK' : dL_dK , #NEWLINE# 'dL_dthetaL' : dL_dthetaL , #NEWLINE# #UNINDENT# } )