tests/testthat/test_cosine_sim.R

a = c(2, 1, 0, 2, 0, 1, 1, 1)
b <- c(2, 1, 1, 1, 1, 0, 1, 1)

test_that("cosine similarity test", {

  expect_equal(0.1784162, as.numeric(cosine_dist(rbind(a,b))), tolerance = 1e-6)

})

Try the jmotif package in your browser

Any scripts or data that you put into this service are public.

jmotif documentation built on March 26, 2020, 7:23 p.m.