Weight TF-IDF
Hey all,
I'm using the Process Documents operator to output a tokenized word vector for each document, with the TF-IDF calculated. I'd also like to weight the TF-IDF by the number of tokens in each document. I have the number of tokens (Num_Tokens) calculated for each document, but I can't figure out a way to divide TF-IDF by Num_Tokens for each term in each document. Any tips? Thanks!
I'm using the Process Documents operator to output a tokenized word vector for each document, with the TF-IDF calculated. I'd also like to weight the TF-IDF by the number of tokens in each document. I have the number of tokens (Num_Tokens) calculated for each document, but I can't figure out a way to divide TF-IDF by Num_Tokens for each term in each document. Any tips? Thanks!
Tagged:
0
Answers
TFIDF calculated for each attribute in your dataset with each example representing one document.
An additional attribute showing the number of tokens in each document.
And you want to calculate the TFIDF / Num_tokens for each example & each attribute?
If this is the right interpretation I'd recommend using Generate Attributes inside a Loop Attributes operator.
This will loop through all your TFIDF attributes and then (using a macro) you can divide that attribute by your num_tokens value.
Hope that helps