def METHOD_NAME(weighting_log, bm25_model):
    k1 = bm25_model.bm25_k1
    b = bm25_model.bm25_b
    avgdl = (2 + 3) / 2
    log = bm25_model._get_tf_bm25(weighting_log).toPandas()
    assert np.allclose(
        log[log["item_idx"] == 1]["relevance"],
        1 * (k1 + 1) / (1 + k1 * (1 - b + b * 3 / avgdl)),
    )
    assert np.allclose(
        log[log["item_idx"] == 0]["relevance"],
        1 * (k1 + 1) / (1 + k1 * (1 - b + b * 2 / avgdl)),
    )
    idf = bm25_model._get_idf(weighting_log).toPandas()
    assert np.allclose(
        idf[idf["user_idx"] == 1]["idf"],
        np.log1p((2 - 1 + 0.5) / (1 + 0.5)),
    )
    assert np.allclose(
        idf[idf["user_idx"] == 0]["idf"],
        np.log1p((2 - 2 + 0.5) / (2 + 0.5)),
    )
    assert np.allclose(
        idf[idf["user_idx"] == 2]["idf"],
        np.log1p((2 - 2 + 0.5) / (2 + 0.5)),
    )
    bm25_model.fit(weighting_log)
    recs = bm25_model.predict(weighting_log, k=1, users=[0, 1]).toPandas()
    assert recs.loc[recs["user_idx"] == 1, "item_idx"].iloc[0] == 0