def kernel_matrix(self, X): # check for stupid mistake assert X.shape[0] > X.shape[1] sq_dists = squareform(pdist(X, 'sqeuclidean')) K = np.exp(-sq_dists/ self.scaling) return K