Skip to content

v0.4.0

Choose a tag to compare

@x-tabdeveloping x-tabdeveloping released this 25 Jun 11:04
· 583 commits to main since this release
1dbf359

Release Highlights:

1. Online KeyNMF

KeyNMF can now be fitted in an online fashion in batches:

from itertools import batched
from turftopic import KeyNMF

model = KeyNMF(10, top_n=5)

corpus = ["some string", "etc", ...]
for batch in batched(corpus, 200):
    batch = list(batch)
    model.partial_fit(batch)

2. Precompute keyword matrices in KeyNMF

You can precompute the keyword matrix of KeyNMF models and then use them in training.

model.extract_keywords(["Cars are perhaps the most important invention of the last couple of centuries. They have revolutionized transportation in many ways."])
[{'transportation': 0.44713873,
  'invention': 0.560524,
  'cars': 0.5046208,
  'revolutionized': 0.3339205,
  'important': 0.21803442}]
keyword_matrix = model.extract_keywords(corpus)
model.fit(keywords=keyword_matrix)

3. Concept Compass in $S^3$

You can now produce a concept compass figure with $S^3$ similar to that in the paper:

from turftopic import SemanticSignalSeparation

model = SemanticSignalSeparation(10).fit(corpus)

# You will need to `pip install plotly` before this.
fig = model.concept_compass(topic_x=1, topic_y=4)
fig.show()

4. Bugfixes in Dynamic Modeling

Binning is now fixed in dynamic modeling and will create the appropriate number of time slices when asked to. The first time slice is not left out either.