(self)
return " * ".join(w)
A mathematical representation of the overall weighting scheme
        used to determine values in the vectorized matrix, depending on the
        params used to initialize the :class:`Vectorizer`.
A mathematical representation of the overall weighting scheme
        used to determine values in the vectorized matrix, depending on the
        params used to initialize the :class:`Vectorizer`.
A mathematical representation of the overall weighting scheme used to determine values in the vectorized matrix depending on the params used to initialize the : class : Vectorizer .
def weighting(self) -> str:
        """
        A mathematical representation of the overall weighting scheme
        used to determine values in the vectorized matrix, depending on the
        params used to initialize the :class:`Vectorizer`.
        """
        w = []
        tf_types = {
            "binary": "1",
            "linear": "tf",
            "sqrt": "sqrt(tf)",
            "log": "log(tf)",
            "bm25": {
                True: "(tf * (k + 1)) / (tf + k * (1 - b + b * (length / avg(lengths)))",
                False: "(tf * (k + 1)) / (tf + k)",
            },
        }
        idf_types = {
            "standard": "log(n_docs / df) + 1",
            "smooth": "log((n_docs + 1) / (df + 1)) + 1",
            "bm25": "log((n_docs - df + 0.5) / (df + 0.5))",
        }
        dl_types = {
            "linear": "1/length",
            "sqrt": "1/sqrt(length)",
            "log": "1/log(length) + 1",
        }
        if self.tf_type == "bm25":
            w.append(tf_types[self.tf_type][bool(self.dl_type)])
        else:
            w.append(tf_types[self.tf_type])
        if self.idf_type:
            w.append(idf_types[self.idf_type])
        if self.dl_type and self.tf_type != "bm25":
            w.append(dl_types[self.dl_type])
        return " * ".join(w)
def weighting ( self ) -> str : w = [ ] tf_types = { "binary" : "1" , "linear" : "tf" , "sqrt" : "sqrt(tf)" , "log" : "log(tf)" , "bm25" : { True : "(tf * (k + 1)) / (tf + k * (1 - b + b * (length / avg(lengths)))" , False : "(tf * (k + 1)) / (tf + k)" , } , } idf_types = { "standard" : "log(n_docs / df) + 1" , "smooth" : "log((n_docs + 1) / (df + 1)) + 1" , "bm25" : "log((n_docs - df + 0.5) / (df + 0.5))" , } dl_types = { "linear" : "1/length" , "sqrt" : "1/sqrt(length)" , "log" : "1/log(length) + 1" , } if self . tf_type == "bm25" : w . append ( tf_types [ self . tf_type ] [ bool ( self . dl_type ) ] ) else : w . append ( tf_types [ self . tf_type ] ) if self . idf_type : w . append ( idf_types [ self . idf_type ] ) if self . dl_type and self . tf_type != "bm25" : w . append ( dl_types [ self . dl_type ] ) return " * " . join ( w )