File: cos_sim.Rd

package info (click to toggle)
r-bioc-mutationalpatterns 3.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,908 kB
  • sloc: sh: 8; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cos_sim.R
\name{cos_sim}
\alias{cos_sim}
\title{Cosine similarity function}
\usage{
cos_sim(x, y)
}
\arguments{
\item{x}{Vector 1 of length n}

\item{y}{Vector 2 of length n}
}
\value{
Cosine similarity value; a value between 0 and 1
}
\description{
Calculate the cosine similarity between two vectors of the same length.
The cosine similarity is a value between 0 (distinct) and 1 (identical)
and indicates how much two vectors are alike.
}
\examples{
x <- c(1.1, 2.1, 0.2, 0.1, 2.9)
y <- c(0.9, 1.9, 0.5, 0.4, 3.1)
cos_sim(x, y)
}