Borrar filtros
Borrar filtros

How can I convert a matrix into a dissimilarity matrix??

6 visualizaciones (últimos 30 días)
Virtualkeeda
Virtualkeeda el 6 de En. de 2016
Respondida: Taro Ichimura el 19 de Jun. de 2016
I have a matrix with so many negative and non-negative values of dimension 54x16063. Can i convert this matrix into a dissimilarity matrix??.... How??

Respuestas (1)

Taro Ichimura
Taro Ichimura el 19 de Jun. de 2016
Hello, The Matlab help on this matter is extremely poorly described... you can use the function pdist and squareform. If you have a matrix X, then use
D = pdist(X)
which convert your matrix into a 1x (n(n-1)/2) (its a vector). Several option of metric are available such as Euclidian or correlation (see pdist help).
IF you need to visualize the Dissimilarity matrix, then use the function squareform to put it back in a square form with a diagonal, typically of dissimilarity matrix. then you can plot(D).
If you need to do Pearson correlation then dissimilarity matrix, you can do: corr(X), then do (matrix of 1)-(Pearson matrix), because Pearson corr is already a measure of similarity.
Hope that helps,

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by