Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2370 (discussed in #2349).
Summary
In
BERTopic.topics_over_time(), whenevolution_tuning=True(index != 0), row updates were written to a temporarylil_matrixreturned byc_tf_idf.tolil()and never assigned back toc_tf_idf:Because
tolil()returns a copy rather than a view,c_tf_idfremained unchanged andevolution_tuning=Truehad no effect on extracted topic words or subsequentprevious_c_tf_idfslices.Changes
c_tf_idftolil_matrix, updatecurrent_overlap_idxrows with the averagedc_tf_idfvalues (whencurrent_overlap_idxis non-empty), and convert back tocsr_matrix(c_tf_idf = c_tf_idf_lil.tocsr()).test_evolution_tuning_updates_c_tf_idf) intests/test_variations/test_dynamic.pyverifying thatevolution_tuning=Truepropagates previous-timestamp topic terms into overlapping topics at subsequent timestamps.