Can cosine similarity be applied to multidimensional matrices?
Don't hack. Do the math instead.

You could reshape your matrix into a vector, then use cosine.

But whether that is sensible to do: ask yourself.

You could also ignore the matrix and always return 0. That is a proper similarity, too. Just usually not useful.

Don't just use some function because you heard the name. You need to understand it's properties, and you need to check whether these properties are helpful for your problem, or not. Choose one because math says this is solving your problem; don't replace the math with random guessing.


Cosine similarity link 1
Cosine similarity link 2
Cosine similarity link 3