def fit(self, Xt, yt):
self.Xt = Xt
x0 = np.zeros(Xt.shape[0])
# returns an approximate solution of the inner optimization
K = pairwise_kernels(Xt, gamma=np.exp(self.alpha0[0]), metric='rbf')
(out, success) = splinalg.cg(
K + np.exp(self.alpha0[1]) * np.eye(x0.size), yt, x0=x0)
if success is False:
raise ValueError
self.dual_coef_ = out
评论列表
文章目录