#NEWLINE# def transform( self , K , y = None , copy = True ) : #NEWLINE# #INDENT# 'Center kernel matrix.\n\n        Parameters\n        ----------\n        K : numpy array of shape [n_samples1, n_samples2]\n            Kernel matrix.\n\n        copy : boolean, optional, default True\n            Set to False to perform inplace computation.\n\n        Returns\n        -------\n        K_new : numpy array of shape [n_samples1, n_samples2]\n        ' #NEWLINE# check_is_fitted ( self , 'K_fit_all_' ) #NEWLINE# K = check_array ( y , copy = copy , dtype = FLOAT_DTYPES ) #NEWLINE# K_pred_cols = ( np . sum ( K , axis = 1 ) / self . K_fit_rows_ . shape [ 0 ] ) [ : , np . newaxis ] #NEWLINE# K -= self . K_fit_rows_ #NEWLINE# K -= K_pred_cols #NEWLINE# K += self . K_fit_all_ #NEWLINE# return K