|
19 | 19 |
|
20 | 20 | > This package is still work in progress and scientific papers on some of the novel methods are currently undergoing peer-review. If you use this package and you encounter any problem, let us know by opening relevant issues. |
21 | 21 |
|
22 | | -#### New in version 0.3.0: Dynamic KeyNMF |
23 | | -KeyNMF can now be used for dynamic topic modeling. |
| 22 | +### New in version 0.4.0 |
| 23 | + |
| 24 | +#### Online KeyNMF |
| 25 | + |
| 26 | +You can now online fit and finetune KeyNMF as you wish! |
24 | 27 |
|
25 | 28 | ```python |
26 | | -from datetime import datetime |
| 29 | +from itertools import batched |
27 | 30 | from turftopic import KeyNMF |
28 | 31 |
|
29 | | -corpus: list[str] = [...] |
30 | | -timestamps = list[datetime] = [...] |
| 32 | +model = KeyNMF(10, top_n=5) |
31 | 33 |
|
32 | | -model = KeyNMF(10) |
33 | | -doc_topic_matrix = model.fit_transform_dynamic(corpus, timestamps=timestamps, bins=10) |
| 34 | +corpus = ["some string", "etc", ...] |
| 35 | +for batch in batched(corpus, 200): |
| 36 | + batch = list(batch) |
| 37 | + model.partial_fit(batch) |
| 38 | +``` |
34 | 39 |
|
35 | | -model.print_topics_over_time() |
| 40 | +#### $S^3$ Concept Compasses |
36 | 41 |
|
37 | | -# This needs Plotly: pip install plotly |
38 | | -model.plot_topics_over_time() |
| 42 | +You can now produce a compass of concepts along two semantic axes using $S^3$. |
| 43 | + |
| 44 | +```python |
| 45 | +from turftopic import SemanticSignalSeparation |
| 46 | + |
| 47 | +model = SemanticSignalSeparation(10).fit(corpus) |
| 48 | + |
| 49 | +# You will need to `pip install plotly` before this. |
| 50 | +fig = model.concept_compass(topic_x=1, topic_y=4) |
| 51 | +fig.show() |
39 | 52 | ``` |
40 | 53 |
|
| 54 | +<p align="center"> |
| 55 | + <img src="../images/arxiv_ml_compass.png" width="60%" style="margin-left: auto;margin-right: auto;"> |
| 56 | +</p> |
| 57 | + |
41 | 58 | ## Basics [(Documentation)](https://x-tabdeveloping.github.io/turftopic/) |
42 | 59 | [](https://colab.research.google.com/github/x-tabdeveloping/turftopic/blob/main/examples/basic_example_20newsgroups.ipynb) |
43 | 60 |
|
|
0 commit comments