def df2idf(docfreq, totaldocs, log_base=2.0, add=0.0):
 return (add + math.log(((1.0 * totaldocs) / docfreq), log_base))

def df2idf ( docfreq , totaldocs , log_base = 2.0 , add = 0.0 ) : return ( add + math . log ( ( ( 1.0 * totaldocs ) / docfreq ) , log_base ) )
compute default inverse-document-frequency for a term with document frequency doc_freq:: idf = add + log .