How to measure the similarity of two data

后端 未结 2 827
天命终不由人
天命终不由人 2021-01-29 12:06

I am measuring the similarity of two data with same size is 20. That is

A=[0.915450999999999    0.908220499999997   0.900374999999996   0.890547499999996   0.88         


        
2条回答
  •  抹茶落季
    2021-01-29 12:51

    As suggested here, you could use cosine similarity, which finds the angle between two vectors. Similar vectors have a value close to 1 and dissimilar vectors have a value close to 0.

    function d = cosSimilarity(u, v)
        d = dot(u,v)/(norm(u)*norm(v));
    end
    

提交回复
热议问题