The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
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