Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

A measure of the angular distance between two vectors. Usually defined as 1-(cosine similarity).

A distance measure of the angle between two vectors $\mathbf u$ and $\mathbf v$,

$$1 - \text{cos}(\mathbf u, \mathbf v)$$


$$\text{cos}(\mathbf u, \mathbf v) = \cfrac{\langle \mathbf u, \mathbf v \rangle}{\| \mathbf u \| \| \mathbf v \|} = \left\langle \cfrac{\mathbf u}{\| \mathbf u\|}, \cfrac{\mathbf v}{\| \mathbf v\|}\right\rangle,$$

or "cosine similarity," is the cosine of the angle between $\mathbf u$ and $\mathbf v$.

The cosine similarity and cosine distance functions are often used in Information Retrieval and Text Mining for document ranking and clustering.

See also

history | excerpt history