nmf-topic-modeling

Extract latent topics from text corpora using NMF on TF-IDF matrices.

13|2|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/aaddrick/written-voice-replication --skill nmf-topic-modeling-aaddrick
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nmf-topic-modeling
Source: https://github.com/aaddrick/written-voice-replication/tree/main/.claude/skills/nmf-topic-modeling
Command: npx skills add https://github.com/aaddrick/written-voice-replication --skill nmf-topic-modeling-aaddrick

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires scikit-learn, numpy, pandas.

What problem does it solve? Analyzing a large text corpus by hand makes it nearly impossible to discover hidden themes and connections across documents. This Skill automates unsupervised topic discovery with Non-negative Matrix Factorization, producing interpretable, labeled themes with measurable coherence scores. ## Core Features & Use Cases - Automated Topic Extraction: Builds a TF-IDF matrix, sweeps k values with UMass coherence scoring, and fits an NMF model to surface distinct themes. - Cross-Topic Connection Analysis: Identifies bridge documents that span multiple topics and computes topic correlation matrices. - LDA Cross-Validation: Optionally compares NMF results against Latent Dirichlet Allocation to confirm which themes are robust across methods. - Use Case: Given 2,000 Reddit comments, run the pipeline to discover 10 coherent themes, label each with human review, and write a structured findings report to docs/analysis/05-nmf-topic-modeling.md. ## Quick Start Use the nmf-topic-modeling skill to discover the main themes across all documents in my corpus and write the analysis report.

Frequently Asked Questions about nmf-topic-modeling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the number of topics for NMF topic modeling?

Sweep a range of k values (e.g., 3-20) and compute UMass coherence for each fitted model. Select k at the elbow where coherence stops improving, preferring the smaller value when scores are similar.

NMF vs LDA for topic modeling: which should I use?

NMF works on TF-IDF matrices and produces more distinct, coherent topics, especially for shorter texts. LDA uses raw word counts and provides probabilistic topic distributions. Cross-checking both methods strengthens confidence in shared themes.

How many documents do I need for NMF topic modeling?

At least 100 documents for viable results, with 500+ supporting 8-15 topics. Below 50 documents the factorization is too sparse to be meaningful; between 50-100, reduce k to 3-5 and flag results as exploratory.

Why are my NMF topics incoherent or overlapping?

Incoherent topics usually mean k is too high, stopwords are insufficient, or the corpus lacks thematic structure. Iterate by adding noisy terms to the stopword list, refitting, and lowering k if topics share dominant terms.

Should I use TF-IDF or raw counts with NMF?

Use TF-IDF with NMF; it is the fundamental strength of the method and produces cleaner topics. Raw count matrices favor LDA instead, which models word counts probabilistically.