What is the formula and log base for idf? To calculate tf-idf, we do:

tf*idf 

tf=number of times word occurs in document 

What is formula for idf and log base:


Log(number of documents/number of documents containing the word)
Log((1+number of documents)/(1+number of documents containing the word))
1+Log(number of documents/number of documents containing the word)
1+Log((1+number of documents)/(1+number of documents containing the word))
There a a number of variation how to calculate inverse document frequency. Have a look at the wiki page (Tf-Idf) or scikit-learn's TfidfVetorizer class.