def symmetrize(X): return X + X.T - np.diag(X.diagonal()) #this code is directly translated from the GPML Matlab package (see attached license)