R Programming By Example: Practical, hands-on projects to help you get started with R by Omar Trejo Navarro

R Programming By Example: Practical, hands-on projects to help you get started with R by Omar Trejo Navarro

Author:Omar Trejo Navarro [Navarro, Omar Trejo]
Language: eng
Format: epub
Tags: COM042000 - COMPUTERS / Natural Language Processing, COM077000 - COMPUTERS / Mathematical and Statistical Software, COM051010 - COMPUTERS / Programming Languages / General
Publisher: Packt Publishing
Published: 2017-12-22T00:00:00+00:00


Extending our analysis with cosine similarity

Now we proceed to another technique familiar in linear algebra which operates on a vector space. The technique is known as cosine similarity (CS), and its purpose is to find vectors that are similar (or different) from each other. The idea is to measure the direction similarity (not magnitude) among client messages, and try to use it to predict similar outcomes when it comes to multiple purchases. The cosine similarity will be between 0 and 1 when the vectors are orthogonal and perpendicular, respectively. However, this similarity should not be interpreted as percentage because the movement rate for the cosine function is not linear. This means that a movement from 0.2 to 0.3 does not represent a similar movement magnitude from 0.8 to 0.9.

Given two vectors (rows in our DFM), the cosine similarity among them is computed by taking the dot product between them and dividing it by the product of the Euclidian norms. To review what these concepts mean, take a look at Meyer's, Matrix Analysis & Applied Linear Algebra, 2000.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.