Dod-o / Statistical-Learning-Method_Code

手写实现李航《统计学习方法》书中全部算法

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVM中第342行 calcSinglKernel函数是不是多计算了一遍exp

hao14293 opened this issue · comments

def calcSinglKernel(self, x1, x2):
    '''
    单独计算核函数
    :param x1: 向量1
    :param x2: 向量2
    :return: 核函数结果
    '''
    # 7.90
    result = (x1 - x2) * (x1 - x2).T
    result = np.exp(-1 * result / (2 * self.sigma ** 2))
    return result
commented

确实,会在近期修改,感谢~