Skip to content

Is it possible to pass a pre-computed TF-IDF matrix? #13

Answered by xhluca
celsofranssa asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the question! Unfortunately the BM25 algorithm differ slightly from tf-idf, so the scores you will have are different. If you absolutely want to pass something, you would need to modify the indptr, indices, and data keys of obj.scores where obj is your bm25s.BM25 instance.

Here's how it is currently being built behind the scene: https://github.com/xhluca/bm25s/blob/35036613340e2511790213a6fb988e573b1936e6/bm25s/__init__.py#L255-L270C16

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by celsofranssa
Comment options

You must be logged in to vote
1 reply
@xhluca
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #9 on June 27, 2024 15:48.