kgof/kernel.py
def eval(self, X, Y):
        """
        Evaluate the kernel on data X and Y
        X: nx x d where each row represents one point
        Y: ny x d
        return nx x ny Gram matrix
        """
        sumx2 = np.sum(X**2, axis=1)[:, np.newaxis]
        sumy2 = np.sum(Y**2, axis=1)[np.newaxis, :]
        D2 = sumx2 - 2 * np.dot(X, Y.T) + sumy2
        return np.tensordot(
            self.wts,
            np.exp(
                D2[np.newaxis, :, :]
                / (-2 * self.sigma2s[:, np.newaxis, np.newaxis])),
            1)

        Evaluate the kernel on data X and Y
        X: nx x d where each row represents one point
        Y: ny x d
        return nx x ny Gram matrix
        
Evaluate the kernel on data X and Y
X: nx x d where each row represents one point
Y: ny x d
return nx x ny Gram matrix
Evaluate the kernel on data X and Y X : nx x d where each row represents one point Y : ny x d return nx x ny Gram matrix
def eval(self, X, Y):
        sumx2 = np.sum(X**2, axis=1)[:, np.newaxis]
        sumy2 = np.sum(Y**2, axis=1)[np.newaxis, :]
        D2 = sumx2 - 2 * np.dot(X, Y.T) + sumy2
        return np.tensordot(
            self.wts,
            np.exp(
                D2[np.newaxis, :, :]
                / (-2 * self.sigma2s[:, np.newaxis, np.newaxis])),
            1)
def eval ( self , X , Y ) : sumx2 = np . sum ( X ** 2 , axis = 1 ) [ : , np . newaxis ] sumy2 = np . sum ( Y ** 2 , axis = 1 ) [ np . newaxis , : ] D2 = sumx2 - 2 * np . dot ( X , Y . T ) + sumy2 return np . tensordot ( self . wts , np . exp ( D2 [ np . newaxis , : , : ] / ( - 2 * self . sigma2s [ : , np . newaxis , np . newaxis ] ) ) , 1 )
Evaluate the kernel on data X and Y
X: nx x d where each row represents one point
Y: ny x d
return nx x ny Gram matrix
Evaluate the kernel on data X and Y X : nx x d where each row represents one point Y : ny x d return nx x ny Gram matrix
"""
        Evaluate the kernel on data X and Y
        X: nx x d where each row represents one point
        Y: ny x d
        return nx x ny Gram matrix
        """
self
X
Y