On 11/15/2012 10:41 PM, sara wrote:
> I know the definition. My problem is the dot(A.B) works for same size vectors
>but my vectors have different sizes. (I converted documents to vectors to cluster them)
>
If a vector V1 spans 2D only and the other vector V2 spans 3D, this
means V1 has a zero in that third component.
So, all you have to do is make them all live in the same
space, which means the same length. Add zeros to make them same
size then then use the definition.
>> Well, cosine similarity is defined here
>>
>> http://en.wikipedia.org/wiki/Cosine_similarity
>>
>> So, all what you have to do is type the Matlab code for it?
>> may be
>>
>> dot(A,B)/(norm(A)*norm(B))
>>
>>
>>
>>
>>
> I know the definition. My problem is the dot(A.B) works for same size vectors
>but my vectors have different sizes. (I converted documents to vectors to cluster them)
>
If a vector V1 spans 2D only and the other vector V2 spans 3D, this
means V1 has a zero in that third component.
So, all you have to do is make them all live in the same
space, which means the same length. Add zeros to make them same
size then then use the definition.
>> Well, cosine similarity is defined here
>>
>> http://en.wikipedia.org/wiki/Cosine_similarity
>>
>> So, all what you have to do is type the Matlab code for it?
>> may be
>>
>> dot(A,B)/(norm(A)*norm(B))
>>
>>
>>
>>
>>