All problems
Smooth Inverse Document Frequency Value
Problem
A smoothed IDF is ln((N + 1) / (df + 1)) + 1, which stays positive for every term.
Given the number of documents N and the document frequency df, return the smooth IDF.
Hint
The +1 shift keeps rare and common terms comparable.
Test cases
case 1
in: [100,10]
expected: 3.217225244042889
case 2
in: [5,5]
expected: 1
case 3
in: [1000,1]
expected: 7.215607598755275
Starter codePython
def smooth_inverse_document_frequency_value(n_docs, df):
# Your code here
pass3 test cases · run your code against them in the editor