Difference between Cosine Similarity and Spectral Angle Mapper?

31 次查看(过去 30 天)
I have been doing some work with comparing spectral vector similarity using cosine similarity (CS). While I was exploring the literature, I came across the concept of "Spectral Angle Mapper" (SAM). To me, the two appeared equivalent from a mathematics perspective, with the exception that SAM takes the arccosine of the value. Is there something I am missing, or are these two values essentially equivalent (at least computationally, maybe not conceptually)?
A related question as well: Is cosine similarity(CS)/SAM insensitive to magnitude? There seems to be some disagreement in the literature. For example, one paper said that given two vectors for comparison (X and Y), if Z= kX, then CS(ZY) does not equal CS (XY). In my experience, however, CS(ZY) = CS (XY), unless I am doing something wrong.
Thank you for your help and I look forward to the replies!

回答(1 个)

Gagan Agarwal
Gagan Agarwal 2023-9-22
Hi Adam Rish,
To address your first question,
Yes, both Cosine Similarity and Spectral Angle Mapper share some mathematical similarities, but they also have distinct characteristics such as:
  1. Range of values: Cosine Similarity ranges from -1 to 1, whereas for Spectral Angle Mapper, the values range typically between 0 and π/2 (0 to 90 degrees).
  2. Dimensionality: Cosine Similarity operates on the entire vector space, comparing the similarity of all spectral bands. Spectral Angle Mapper, on the other hand, operates on the angle between vectors in a high-dimensional space.
To address your second question,
Yes, both Cosine Similarity and Spectral Angle Mapper are intended to be insensitive to magnitude variations as Cosine Similarity focuses on the similarity of spectral reflectance values, while Spectral Angle Mapper considers the angles between spectral vectors in a high-dimensional space.
And in the case, you mentioned, where Z = kX , CS(ZY) should indeed be equal to CS(XY). This is because Cosine Similarity measures the angle between vectors, which is independent of their magnitudes.
I hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by