|
Calling Sequence
|
|
CosineCoefficient( v1, v2 )
BinaryCosineCoefficient( v1, v2 )
|
|
Parameters
|
|
v1, v2
|
-
|
vector or list of integers
|
|
|
|
|
Description
|
|
•
|
The cosine coefficient is a measure of similarity between two vectors.
|
•
|
In binary form, where the vectors contain 1's and 0's, the formula can be expressed in set notation.
|
•
|
Both v1 and v2 must be the same size.
|
•
|
In the context of text comparison, v1 and v2 could be a count of the occurrences of certain words within two essay sets. In the binary form v1 and v2 would contain 1 for the presence of a word, and 0 for its absence.
|
•
|
For positive integer counts, the Cosine and BinaryCosine coefficients will range from 0 to 1, where 1 is a perfect match, and 0 indicates no overlap. The higher the score in-between, the more similar the vectors.
|
•
|
The Binary form of this command will accept any vector as input and interpret all non-zero entries as 1s.
|
•
|
This function is part of the EssayTools package, so it can be used in the short form CosineCoefficient(..) only after executing the command with(EssayTools). However, it can always be accessed through the long form of the command by using EssayTools[CosineCoefficient](..).
|
|
|
Examples
|
|
| (1) |
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (8) |
>
|
|
>
|
|
>
|
|
>
|
|
| (12) |
>
|
|
>
|
|
>
|
|
>
|
|
|
|
Compatibility
|
|
•
|
The EssayTools[CosineCoefficient] and EssayTools[BinaryCosineCoefficient] commands were introduced in Maple 17.
|
|
|
|