def _update_inverses(self): """ Calculates and stores kernel, and its inverses. """ for j in range(self.num_latent_proc): self.Kzz[j, :, :] = self.kernels_latent[j].K(self.Z[j, :, :]) self.chol[j, :, :] = jitchol(self.Kzz[j, :, :]) self.invZ[j, :, :] = inv_chol(self.chol[j, :, :]) self.log_detZ[j] = pddet(self.chol[j, :, :]) self.hypers_changed = False self.inducing_changed = False
def update_covariance(self, j, Sj): Sj = Sj.copy() mm = min(Sj[np.diag_indices_from(Sj)]) if mm < 0: Sj[np.diag_indices_from(Sj)] = Sj[np.diag_indices_from(Sj)] - 1.1 * mm for k in range(self.num_comp): self.s[k,j] = Sj.copy() self.L[k,j] = jitchol(Sj,10) tmp = self.L[k,j].copy() tmp[np.diag_indices_from(tmp)] = np.log(tmp[np.diag_indices_from(tmp)]) self.L_flatten[k,j] = tmp[np.tril_indices_from(tmp)] self._update()
def update_covariance(self, j, Sj): Sj = Sj.copy() mm = min(Sj[np.diag_indices_from(Sj)]) if mm < 0: Sj[np.diag_indices_from( Sj)] = Sj[np.diag_indices_from(Sj)] - 1.1 * mm for k in range(self.num_comp): self.s[k, j] = Sj.copy() self.L[k, j] = jitchol(Sj, 10) tmp = self.L[k, j].copy() tmp[np.diag_indices_from(tmp)] = np.log( tmp[np.diag_indices_from(tmp)]) self.L_flatten[k, j] = tmp[np.tril_indices_from(tmp)] self._update()