tests/test-existence_collision.R

library(FeatureHashing)
df <- data.frame(a = c("a,b,c", "a,c", "b,c", "a"))
m <- hashed.model.matrix(~ split(a, delim = ",", type = "existence") - 1, df, 
                         hash.size = 4, signed.hash = FALSE, create.mapping = TRUE)
hash.mapping(m)
stopifnot(m@x == 1)
wush978/FeatureHashing documentation built on Oct. 23, 2022, 10:16 a.m.