def _gt_mapping(D, W, Z):
"""Computes the mapping B(X) for a Guttman transform V X = B(X) Z."""
# Compute the Euclidean distances between all pairs of points
Dz = distance.cdist(Z, Z)
# Fill the diagonal of Dz, because *we don't want a division by zero*
np.fill_diagonal(Dz, 1e-5)
B = - W * D / Dz
np.fill_diagonal(B, 0.0)
B[np.diag_indices(B.shape[0])] = -np.sum(B, axis=1)
return B
mds_with_anchors.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录