Aligned Neural Topic Model for Exploring Evolving Topics
Project description
ANTM
ANTM: An Aligned Neural Topic Model for Exploring Evolving Topics
Dynamic topic models are effective methods that primarily focus on studying the evolution of topics present in a collection of documents. These models are widely used for understanding trends, exploring public opinion in social networks, or tracking research progress and discoveries in scientific archives. Since topics are defined as clusters of semantically similar documents, it is necessary to observe the changes in the content or themes of these clusters in order to understand how topics evolve as new knowledge is discovered over time. Here, we introduce a dynamic neural topic model called ANTM, which uses document embeddings (data2vec) to compute clusters of semantically similar documents at different periods, and aligns document clusters to represent their evolution. This alignment procedure preserves the temporal similarity of document clusters over time and captures the semantic change of words characterized by their context within different periods. Experiments on four different datasets show that ANTM outperforms probabilistic dynamic topic models (e.g. DTM, DETM) and significantly improves topic coherence and diversity over other existing dynamic neural topic models (e.g. BERTopic).
Installation
Installation can be done using:
pip install antm
Quick Start
As implemented in the notebook, we can quickly start extracting evolving topics from DBLP dataset containing computer science articles.
To Fit and Save a Model
from src import antm
import pandas as pd
# load data
df = pd.read_parquet("./data/dblpFullSchema_2000_2020_extract_big_data_1K.parquet")
df = df[["abstract", "year"]].rename(columns={"abstract": "content", "year": "time"}).dropna().reset_index()
# choosing the windows size and overlapping length for time frames
window_size = 3
overlap = 1
# initialize model
model = ANTM(df, overlap, window_size, mode="data2vec", num_words=10, path="./saved_data")
# learn the model and save it
model.fit(save=True)
To Load a Model
from src import antm
import pandas as pd
# load data
df = pd.read_parquet("./data/dblpFullSchema_2000_2020_extract_big_data_1K.parquet")
df = df[["abstract", "year"]].rename(columns={"abstract": "content", "year": "time"}).dropna().reset_index()
window_size = 3
overlap = 1
# initialize the model for loading
model = ANTM(df, overlap, window_size, mode="data2vec", num_words=10, path="./saved_data")
model.load()
Plug-and-Play Functions
#find all the evolving topics
model.save_evolution_topics_plots(display=False)
#plots a random evolving topic with 2-dimensional document representations
model.random_evolution_topic()
#plots partioned clusters for each time frame
model.plot_clusters_over_time()
#plots all the evolving topics
model.plot_evolving_topics()
Datasets
Experiments
You can use the notebooks provided in "./experiments" in order to run ANTM on other sequential datasets.
Citation
To cite ANTM, please use the following bibtex reference:
@misc{rahimi2023antm,
title={ANTM: An Aligned Neural Topic Model for Exploring Evolving Topics},
author={Hamed Rahimi and Hubert Naacke and Camelia Constantin and Bernd Amann},
year={2023},
eprint={2302.01501},
archivePrefix={arXiv},
primaryClass={cs.IR}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file antm-0.0.5.tar.gz
.
File metadata
- Download URL: antm-0.0.5.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e97489a6e5fa0c36ec0d64b3925777900ed66848e6e3c2c2444b1c2e418df8e |
|
MD5 | b7e3cffa28499cb7470c550e7ba5be0c |
|
BLAKE2b-256 | 64fb04e2bde7c1ed42969a9384be10b712dfa56c5f353bb6415de81898d3084b |
File details
Details for the file antm-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: antm-0.0.5-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99b1f76c59fd01cdd2d581e7d048f1b8492bb51693e2c7c303bfa9c8d59c6d07 |
|
MD5 | 99c83a2fa0b81e4c7f119f4c72380c08 |
|
BLAKE2b-256 | 622c9c7573ff39a0d1555600742dd9198ba3360398e0959b6f53031f10bc64cf |