def moments_match_ep(self, Y_i, tau_i, v_i, Y_metadata_i=None):
if Y_i == <NUM_LIT:1>:<EOL><INDENT>sign = <NUM_LIT:1.><EOL><DEDENT>elif Y_i == <NUM_LIT:0> or Y_i == -<NUM_LIT:1>:<EOL><INDENT>sign = -<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if isinstance(self.gp_link, link_functions.Probit):<EOL><INDENT>z = sign*v_i/np.sqrt(tau_i**<NUM_LIT:2> + tau_i)<EOL>phi_div_Phi = derivLogCdfNormal(z)<EOL>log_Z_hat = logCdfNormal(z)<EOL>mu_hat = v_i/tau_i + sign*phi_div_Phi/np.sqrt(tau_i**<NUM_LIT:2> + tau_i)<EOL>sigma2_hat = <NUM_LIT:1.>/tau_i - (phi_div_Phi/(tau_i**<NUM_LIT:2>+tau_i))*(z+phi_div_Phi)<EOL><DEDENT>elif isinstance(self.gp_link, link_functions.Heaviside):<EOL><INDENT>z = sign*v_i/np.sqrt(tau_i)<EOL>phi_div_Phi = derivLogCdfNormal(z)<EOL>log_Z_hat = logCdfNormal(z)<EOL>mu_hat = v_i/tau_i + sign*phi_div_Phi/np.sqrt(tau_i)<EOL>sigma2_hat = (<NUM_LIT:1.> - a*phi_div_Phi - np.square(phi_div_Phi))/tau_i<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(self.gp_link.__name__))<EOL><DEDENT>return np.exp(log_Z_hat), mu_hat, sigma2_hat<EOL>
Moments match of the marginal approximation in EP algorithm

:param i: number of observation (int)
:param tau_i: precision of the cavity distribution (float)
:param v_i: mean/variance of the cavity distribution (float)