Learn R Programming

Radviz (version 0.9.5)

cosine: Compute the Cosine Similarity between the Columns of a Data Set

Description

Given a dataset, compute the cosine similarity between to columns for use in optimization of Dimensional Anchors

Usage

cosine(mat)

Value

A symmetrical matrix with as many rows as there are columns in input

Arguments

mat

A matrix or data.frame

Author

Yann Abraham

David Ruau

Details

implementation by ekstroem (see StackOverflow for details)

Examples

Run this code
data(iris)
das <- c('Sepal.Length','Sepal.Width','Petal.Length','Petal.Width')
mat <- iris[,das]
sim.mat <- cosine(mat)
ncol(mat)
dim(sim.mat)

Run the code above in your browser using DataLab