(
    doc_term_matrix: sp.csr_matrix,
    *,
    type_: Literal["standard", "smooth", "bm25"] = "smooth",
)
return doc_term_matrix.dot(sp.diags(idfs, 0))
Apply inverse document frequency (idf) weighting to a term-frequency (tf)
    weighted document-term matrix, using one of several IDF formulations.

    Args:
        doc_term_matrix: M x N sparse matrix, where M is the # of docs and
            N is the # of unique terms.
        type_: Type of IDF formulation to use.

    Returns:
        Sparse matrix of shape M x N,
        where value (i, j) is the tfidf weight of term j in doc i.

    See Also:
        :func:`get_inverse_doc_freqs()`
Apply inverse document frequency (idf) weighting to a term-frequency (tf)
    weighted document-term matrix, using one of several IDF formulations.
Apply inverse document frequency ( idf ) weighting to a term - frequency ( tf ) weighted document - term matrix using one of several IDF formulations .
def apply_idf_weighting(
    doc_term_matrix: sp.csr_matrix,
    *,
    type_: Literal["standard", "smooth", "bm25"] = "smooth",
) -> sp.csr_matrix:
    """
    Apply inverse document frequency (idf) weighting to a term-frequency (tf)
    weighted document-term matrix, using one of several IDF formulations.

    Args:
        doc_term_matrix: M x N sparse matrix, where M is the # of docs and
            N is the # of unique terms.
        type_: Type of IDF formulation to use.

    Returns:
        Sparse matrix of shape M x N,
        where value (i, j) is the tfidf weight of term j in doc i.

    See Also:
        :func:`get_inverse_doc_freqs()`
    """
    idfs = get_inverse_doc_freqs(doc_term_matrix, type_=type_)
    return doc_term_matrix.dot(sp.diags(idfs, 0))
def apply_idf_weighting ( doc_term_matrix : sp . csr_matrix , * , type_ : Literal [ "standard" , "smooth" , "bm25" ] = "smooth" , ) -> sp . csr_matrix : idfs = get_inverse_doc_freqs ( doc_term_matrix , type_ = type_ ) return doc_term_matrix . dot ( sp . diags ( idfs , 0 ) )