are you asking about polar coordinates?

Solved

Posted on 2011-05-11

I m trying to find similar web services using Cosine Distance Classifier

Kindly help me find a code script in VB to do so ...

Kindly help me find a code script in VB to do so ...

9 Comments

Since you said 'keyword' I assume you want to get the vector by counting how many times each word or keyword appears in the page. Since you are dealing with whole numbers only, you won't need the abs

So get the dot product of the two vectors and divide it by the root sum of squares as you see above.

http://reference.wolfram.c

The code for the formula would look something like this:

```
Function CosineSimilarity(v1, v2)
Dim numer As Integer
Dim denom1 As Double, denom2 As Double
'v1 and v2 are the vectors of the counts of keywords
numer = 0
denom1 = 0
denom2 = 0
For i = 1 To N 'N is the size of the vector
numer = numer + v1[i]*v2[i]
denom1 = denom1 + v1[i]*v1[i]
denom2 = denom2 + v2[i]*v2[i]
Next
CosineSimilarity = 1 - number/(sqrt(denom1)*sqrt(denom2))
End Function
```

By clicking you are agreeing to Experts Exchange's Terms of Use.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**7** Experts available now in Live!