Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pypi version travis-ci build status pypi download statistics

Topic modeling with latent Dirichlet allocation. lda aims for simplicity.

lda implements latent Dirichlet allocation (LDA) using collapsed Gibbs sampling. LDA is described in Blei et al. (2003) and Pritchard et al. (2000).

Installation

pip install lda

Getting started

lda.LDA implements latent Dirichlet allocation (LDA). The interface follows conventions found in scikit-learn.

>>> import numpy as np
>>> import lda
>>> X = np.array([[1,1], [2, 1], [3, 1], [4, 1], [5, 8], [6, 1]])
>>> model = lda.LDA(n_topics=2, n_iter, random_state=1)
>>> doc_topic = model.fit_transform(X)  # estimate of document-topic distributions
>>> model.components_  # estimate of topic-word distributions; model.doc_topic_ is an alias

Requirements

Python 3 is required. The following packages are also required

Caveat

lda aims for simplicity over speed. If you are working with large corpora or want to use faster and more sophisticated topic models, consider using hca or MALLET. hca is written in C and MALLET_ is written in Java.

License

horizont is licensed under Version 2.0 of the Mozilla Public License.

Release history Release notifications | RSS feed

3.0.2

13 files

3.0.1

13 files

3.0.0

17 files

2.0.0

8 files

1.1.0

22 files

1.0.5

19 files

1.0.4

21 files

1.0.3

20 files

1.0.2

10 files

1.0.0

1 file

0.3.2

10 files

0.3.1

10 files

0.3.0

16 files

0.2.0

11 files

0.1.0

1 file

This release

c5b2b31 This release

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page