理论上,如果我计算A = rand(132,6); % input matrixsquare_diss_mat = squareform(diss_mat); % I put the dissimilarities in a square matrixdiss_mat = pdist(A);
squar
如何使用pdist2与“mahalanobis”度量?我写这段代码:n=[1 2 5;2 5 7;5 7 9];The covariance matrix for the Mahalanobis metric must be symmetric andError in ==> Untitled at 5
MATLAB函数pdist不工作。它显示了一个错误Undefined function 'pdist' for input arguments of type 'double'.在工具箱中,我还可以看到一个具有函数pdist.的文件
有人知道这是怎么回事吗?或者,下一步我可以检查其有效性的可能性是什么?谢谢。
pdist所做的是使用欧氏距离(2-范数)作为点之间的距离度量来计算m点之间的距离。在矩阵X ()中,点被排列成m维行向量.因此,要创建一个在熊猫数据框架上运行的函数,需要做几件事,这样就可以使用pdist函数。您将注意到,当点数变得非常大时,pdist是方便的。以下是我的尝试:import numpy as np
import pandas as pd它必须是列表形式,因为pdist函数只对列表进