def __init__(self, gamma): Kernel.__init__(self) if type(gamma) is not float: raise TypeError("Gamma must be float") self.gamma = gamma
def __init__(self, width, nu=1.5, sigma=1.0): Kernel.__init__(self) #GenericTests.check_type(width,'width',float) GenericTests.check_type(nu, 'nu', float) GenericTests.check_type(sigma, 'sigma', float) self.width = width self.nu = nu self.sigma = sigma
def __init__(self, width=1.0, nu=1.5, sigma=1.0): Kernel.__init__(self) GenericTests.check_type(width,'width',float) GenericTests.check_type(nu,'nu',float) GenericTests.check_type(sigma,'sigma',float) self.width = width self.nu = nu self.sigma = sigma
def get_spectrum_on_data(self, Mx, My): '''Mx and My are Kx Ky when rff =False Mx and My are phix, phiy when rff =True''' if self.rff | self.induce_set: Cx = np.cov(Mx.T) Cy = np.cov(My.T) lambdax = np.linalg.eigvalsh(Cx) lambday = np.linalg.eigvalsh(Cy) else: Kxc = Kernel.center_kernel_matrix(Mx) Kyc = Kernel.center_kernel_matrix(My) lambdax = np.linalg.eigvalsh(Kxc) lambday = np.linalg.eigvalsh(Kyc) return lambdax, lambday
def get_spectrum_on_data(self, Mx, My): '''Mx and My are Kx Ky when rff =False Mx and My are phix, phiy when rff =True''' if self.rff|self.induce_set: Cx = np.cov(Mx.T) Cy = np.cov(My.T) lambdax=np.linalg.eigvalsh(Cx) lambday=np.linalg.eigvalsh(Cy) else: Kxc = Kernel.center_kernel_matrix(Mx) Kyc = Kernel.center_kernel_matrix(My) lambdax=np.linalg.eigvalsh(Kxc) lambday=np.linalg.eigvalsh(Kyc) return lambdax,lambday
def __str__(self): s = self.__class__.__name__ + "=[" s += "p=" + str(self.p) s += "alpha=" + str(self.alpha) s += ", " + Kernel.__str__(self) s += "]" return s
def __init__(self, sigma=1.0, is_sparse=False): Kernel.__init__(self) self.width = sigma self.is_sparse = is_sparse
def __init__(self, is_sparse=False): Kernel.__init__(self) self.is_sparse = is_sparse
def __init__(self, degree, theta=1.0): Kernel.__init__(self) self.degree = degree self.theta = theta
def __init__(self, p=1, alpha=0.5, sigma=1.0): Kernel.__init__(self) self.p = p self.alpha = alpha self.sigma = sigma
def __str__(self): s=self.__class__.__name__+ "=[" s += "" + Kernel.__str__(self) s += "]" return s
def HSIC_V_statistic(Kx, Ky): Kxc = Kernel.center_kernel_matrix(Kx) Kyc = Kernel.center_kernel_matrix(Ky) return np.sum(Kxc * Kyc)
def __init__(self, data_kernel): Kernel.__init__(self) self.data_kernel = data_kernel
def __init__(self, is_sparse = False): Kernel.__init__(self) self.is_sparse = is_sparse
def __init__(self, list_of_kernels): Kernel.__init__(self) self.list_of_kernels = list_of_kernels
def HSIC_V_statistic(Kx,Ky): Kxc=Kernel.center_kernel_matrix(Kx) Kyc=Kernel.center_kernel_matrix(Ky) return np.sum(Kxc*Kyc)
def __init__(self, sigma): Kernel.__init__(self) GenericTests.check_type(sigma, 'sigma', float) self.width = sigma
def __init__(self): Kernel.__init__(self)
def __str__(self): s=self.__class__.__name__+ "=[" s += "degree="+ str(self.degree) s += ", " + Kernel.__str__(self) s += "]" return s
def __str__(self): s = self.__class__.__name__ + "=[" s += "gamma=" + str(self.gamma) s += ", " + Kernel.__str__(self) s += "]" return s
def __init__(self, degree,theta=1.0): Kernel.__init__(self) self.degree = degree self.theta = theta
def __str__(self): s = self.__class__.__name__ + "=[" s += ", " + Kernel.__str__(self) s += "]" return s