Monday, 15 June 2015

R character hash function -



R character hash function -

ok question related one: feature hashing in r text classification. what's reasonable way hash character vector integer in r? current code take lastly hex chars , convert then, doesn't seems extract features (i've tested in simple classification problem):

library(digest) bad_hash = function(word, n){ strtoi(substr(digest(word), 28, 32), 16l) %% (n + 1) } bad_hash('this sparta', 100) # 97

thanks!

r hash text-classification

No comments:

Post a Comment