def kernelize(self, x1, x2, type = None): ''' :params: x1: NxD :params: x2: NxD ''' if self.kernel == 'linear': if not type: return Kernels.linear_svdd(x1, x2) else: return Kernels.linear(x1, x2)
def kernelize(self, x1, x2): ''' :params: X: NxD ''' if self.kernel == 'linear': return Kernels.linear(x1, x2) elif self.kernel == 'rbf': return Kernels.rbf(x1, x2) elif self.kernel == 'sigmoid': return Kernels.sigmoid(x1, x2) elif self.kernel == 'polynomial': return Kernels.polynomial(x1, x2) elif self.kernel == 'cosine': return Kernels.cosine(x1, x2) elif self.kernel == 'correlation': return Kernels.correlation(x1, x2)
def kernelize(self, x1, x2): ''' :params: X: NxD ''' if self.kernel == 'linear': return Kernels.linear(x1, x2) elif self.kernel == 'rbf': return Kernels.rbf(x1, x2, gamma=self.gamma) elif self.kernel == 'sigmoid': return Kernels.sigmoid(x1, x2, gamma=self.gamma) elif self.kernel == 'polynomial': return Kernels.polynomial(x1, x2, d=self.d) elif self.kernel == 'cosine': return Kernels.cosine(x1, x2) elif self.kernel == 'correlation': return Kernels.correlation(x1, x2, gamma=self.gamma) elif self.kernel == 'linrbf': return Kernels.linrbf(x1, x2, gamma=self.gamma) elif self.kernel == 'rbfpoly': return Kernels.rbfpoly(x1, x2, d=self.d, gamma=self.gamma) elif self.kernel == 'rbfcosine': return Kernels.rbfpoly(x1, x2, d=self.d, gamma=self.gamma) elif self.kernel == 'etakernel': return Kernels.etakernel(x1, x2, d=self.d, gamma=self.gamma) elif self.kernel == 'alignment': return Kernels.alignment(x1, x2) elif self.kernel == 'laplace': return Kernels.laplacian(x1, x2, gamma=self.gamma) elif self.kernel == 'locguass': return Kernels.locguass(x1, x2, d=self.d, gamma=self.gamma) elif self.kernel == 'chi': return Kernels.chi(x1)