Finding similarity between 2 matrices

I have two matrices, of different sizes (say, 42*42 and 40 *40). The matrix has entries of only zero and one. I want a measure that could quantize the amount of similarity between these two matrices.
I have tried corr2 but output will not be obtained since the 2 matrices are of different size. Even after making the size same by appending zeros, the value of correlation gives small values.
If these matrices are adjacency matrices obtained from different graphs. I want to find out the amount of similarity between these matrices.

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Oct. de 2019
Editada: KALYAN ACHARJYA el 15 de Oct. de 2019
I have two matrices, of different sizes (say, 42*42 and 40 *40). I want a measure that could quantize the amount of similarity between these two matrices.
One way, (Some extent)
A=randi(10,[42,42]);
B=randi(10,[40,40]);
mse_data=mse(A(1:40,1:40),B); % Please note (1:40,1:40),B)
Or Pad the B with 2 lines zeros and do compare
More less value of mse_data, more similar

5 comentarios

Gayathri Nayar
Gayathri Nayar el 15 de Oct. de 2019
Hai, thanks for quick response. I have a doubt "More less value of mse_data, more similar" means lower the value ,greater the similarity, right?
Also, apart from MSE , can you throw some light on any other matrix similarity measure?
KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Oct. de 2019
"More less value of mse_data, more similar" means lower the value ,greater the similarity, right?
Yes
Or
Do subtraction and add all elements, lower value of result more similar (Again Some Extent)
Is this you are looking for here (Matrix similarity)
Regards
Gayathri Nayar
Gayathri Nayar el 15 de Oct. de 2019
But what will be the case when the input matrices consist of only ones and zeros?
I have 2 same things,say images, and 1 different image. i make a graph out of it and match the matrices to find out their similarity so as to ascertain whether they belong to same entity or not.
When I tried MSE, as you have suggested, I didn't find much difference between the values of same image and different image. I want a similarity measure that will help to identify the level of similarity between the 2 inputs.
Something similar to corr2.Since zero padding makes a great difference in the amount of similarity , it can't be used. that's why I am in search of matrix similarity measures.
KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Oct. de 2019
Editada: KALYAN ACHARJYA el 15 de Oct. de 2019
Are you looking for images?
See here SSIM also
Gayathri Nayar
Gayathri Nayar el 15 de Oct. de 2019
it is not purely images. I have said it as an example only. i want to find how much similar are two matrices with zero and ones as its entries.

Iniciar sesión para comentar.

Preguntada:

el 15 de Oct. de 2019

Editada:

el 15 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by