Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch11 Understanding TF-IDF normalization #230

Open
intelligencethink opened this issue Oct 25, 2023 · 0 comments
Open

Ch11 Understanding TF-IDF normalization #230

intelligencethink opened this issue Oct 25, 2023 · 0 comments

Comments

@intelligencethink
Copy link

The explanation of tfidf shown at page326 as below.

def tfidf(term, document, dataset):
term_freq = document.count(term)
doc_freq = math.log(sum(doc.count(term) for doc in dataset) + 1)
return term_freq / doc_freq

Is it right? According to the formula, the total number of documents in the dataset is not shown in doc_freq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant