Skip to main content
  1. Data Science Blog/

Topic Modeling with BERT

·225 words·2 mins· loading · ·
Natural Language Processing (NLP) Data Analysis & Visualization AI/ML Models Language Models (LLMs) NLP Applications Text Analysis Natural Language Processing (NLP) Machine Learning Text Mining

Topic Modeling with BERT

Topic Modeling with BERT
#

Key steps in BERTopic modelling are as following.

  • Use “Sentence Embedding” models to embed the sentences of the article
  • Reduce the dimensionality of embedding using UMAP
  • Cluster these documents (reduced dimensions) using HDBSAN
  • Use c-TF-IDF extract keywords, their frequency and IDF for each cluster.
  • MMR: Maximize Candidate Relevance. How many words in a topic can represent the topic?
  • Intertopic Distance Map
  • Use similarity matrix (heatmap), dandogram (hierarchical map), to visualize the topics and key_words.
  • Traction of topic over time period. Some may be irrelevant and for other traction may be increasing or decreasing.

Installation
#

# Installation, with sentence-transformers, can be done using pypi:

pip install bertopic

# If you want to install BERTopic with other embedding models, you can choose one of the following:

# Choose an embedding backend
pip install bertopic[flair, gensim, spacy, use]

# Topic modeling with images
pip install bertopic[vision]

Supported Topic Modelling Techniques
#

BERTopic supports all kinds of topic modeling techniques as below.

  • Guided
  • Supervised
  • Semi-supervised
  • Manual
  • Multi-topic distributions
  • Hierarchical
  • Class-based
  • Dynamic
  • Online/Incremental
  • Multimodal
  • Multi-aspect
  • Text Generation/LLM
  • Merge Models

Related Resources#

Tools in BERTopic
#

Tools-in-BERTopic

Best Topic Modeling Tool in BERTopic
#

BEST-Tools-in-BERTopic

BERTopic Model Building
#

BERTopic-Model-Building

Application
#

  • arXiv Dataset (1.7m+ STEP papers)
  • Images/photographs
  • Historical Documents
  • News articles

Related

Quantum Hardware Is Not a Smaller or Stranger Classical Computer
·5562 words·27 mins· loading
Interdisciplinary Topics Research & Academia Quantum Computing Quantum Physics Quantum Mechanics Photonics Semiconductor Engineering Interdisciplinary Topics
Quantum Hardware Is Not a Smaller or Stranger Classical Computer # A ground-up guide for engineers …
Bell's Inequality: What It Actually Tests About Reality
·2254 words·11 mins· loading
Interdisciplinary Topics Research & Academia Physics Quantum Physics Quantum Mechanics Philosophy of Science Entanglement Probability
Bell’s Inequality # What it actually tests about reality — explained step by step # Part 18 …
What Is Distance? From Metres to Light-Travel Time and the Meaning of Size
·4301 words·21 mins· loading
Interdisciplinary Topics Research & Academia Physics Special Relativity Quantum Physics Metrology Philosophy of Science Applied Mathematics
What Is Distance? # From metres to light-travel time — and what it really means for an object to …
Anatomy of a Circle — Radius, Arc, Sector, Radian, π, and Every Part in Between
·1826 words·9 mins· loading
Mathematics Research & Academia Mathematics Mathematics for Machine Learning Mathematics for AI Applied Mathematics Geometry Trigonometry
Anatomy of a Circle # Every named part, formula, and diagram — strictly in two dimensions # Part 16 …
Six Trigonometric Functions — One Diagram
·1958 words·10 mins· loading
Mathematics Research & Academia Mathematics Mathematics for Machine Learning Mathematics for AI Applied Mathematics Trigonometry Geometry
Six Trigonometric Functions — One Diagram # All six trig values as lengths on one unit-circle …