Nothing
test_that("Cosine similarity returns correct values", {
x <- c(1, 1)
y <- c(1, 1)
expect_equal(musclesyneRgies::cossim(x, y), 1)
x <- c(1, 1)
y <- c(-1, -1)
expect_equal(musclesyneRgies::cossim(x, y), -1)
x <- c(1, 0)
y <- c(0, 1)
expect_equal(musclesyneRgies::cossim(x, y), 0)
x <- c(1, 0)
y <- c(0, -1)
expect_equal(musclesyneRgies::cossim(x, y), 0)
x <- c(-1, 0)
y <- c(0, 1)
expect_equal(musclesyneRgies::cossim(x, y), 0)
x <- c(-1, 0)
y <- c(0, -1)
expect_equal(musclesyneRgies::cossim(x, y), 0)
x <- c(1, 1)
y <- c(1, 0)
expect_equal(musclesyneRgies::cossim(x, y), sqrt(2)/2)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.