版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lanchunhui/article/details/82532555
样本( )之间的距离矩阵
N, d = X.shape X_square = np.sum(X*X, axis=1).reshape(N, 1) dist_mat = 2*X_square - 2*X.dot(X.T)
def _joint_distribution_matrix(D, sigma): P = np.exp(-D*D/2/sigma**2) P /= np.sum(P, axis=1) return P