Learn R Programming

Radviz (version 0.9.3)

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)

Arguments

mat

A matrix or data.frame

Value

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

Details

implementation by ekstroem (see StackOverflow for details)

Examples

Run this code
# NOT RUN {
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