def __init__(self, X):
Kernel.__init__(self)
self.X_scaled = X/np.sqrt(X.shape[1])
if (X.shape[1] >= X.shape[0] or True): self.K_sq = sq_dist(self.X_scaled.T)
else: self.K_sq = None
#compute dp
self.dp = np.zeros((X.shape[0], X.shape[0]))
for d in xrange(self.X_scaled.shape[1]):
self.dp += (np.outer(self.X_scaled[:,d], np.ones((1, self.X_scaled.shape[0]))) - np.outer(np.ones((self.X_scaled.shape[0], 1)), self.X_scaled[:,d]))
评论列表
文章目录