Text classification - using non-Euclidean distances

We are given the word counts of the keywords algorithm and computer for documents of the classes, informatics and mathematics:

Algorithm words per 1,000

Computer words per 1,000

Subject classification

153

150

Informatics

105

97

Informatics

75

125

Informatics

81

84

Informatics

73

77

Informatics

90

63

Informatics

20

0

Mathematics

33

0

Mathematics

105

10

Mathematics

2

0

Mathematics

84

2

Mathematics

12

0

Mathematics

41

42

?

The documents with a high rate of the words algorithm and computer are in the class of informatics. The class of mathematics happens to contain documents with a high count of the word algorithm in some cases; for example, a document concerned with the Euclidean algorithm from the field of number theory. But, since mathematics tends to be less applied than informatics in the area of algorithms, the word computer is contained in such documents with a lower frequency.

We would like to classify a document that has 41 instances of the word algorithm per 1,000 words and 42 instances of the word computer per 1,000 words:

Analysis:

Using, for example, the 1-NN algorithm and the Manhattan or Euclidean distance would result in the classification of the document in question to the class of mathematics. However, intuitively, we should instead use a different metric to measure the distance, as the document in question has a much higher count of the word computer than other known documents in the class of mathematics.

Another candidate metric for this problem is a metric that would measure the proportion of the counts for the words, or the angle between the instances of documents. Instead of the angle, one could take the cosine of the angle cos(θ), and then use the well-known dot product formula to calculate the cos(θ).

Let a=(ax,ay), b=(bx,by), then instead this formula:

One derives:

Using the cosine distance metric, one could classify the document in question to the class of informatics:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset