Hey, guys, I noticed that bind_tf_idf() doesn't really use dplyr, which has better performance relative to base R. I had a 30% improvement in speed for getting tfidf for a corpus of 100,000 tweets using this code:
corpus %>%
group_by(TextID, word) %>%
count() %>%
group_by(TextID) %>%
mutate(tf = n / sum(n)) %>%
group_by(word) %>%
mutate(Documents = n()) %>%
ungroup() %>%
mutate(idf = log(length(unique(TextID)) / Documents),
tf_idf = tf * idf)
Hey, guys, I noticed that
bind_tf_idf()doesn't really use dplyr, which has better performance relative to base R. I had a 30% improvement in speed for getting tfidf for a corpus of 100,000 tweets using this code: