Skip to main content

An implementation of latent Dirichlet allocation

Project description

ktLDA

This is an implementation of Latent Dirichlet Allocation for pedagogical purposes.

Dependencies

  • numpy
  • tqdm

Examples

from ktlda import KtLDA
import pickle

with open('ourdata-cleaned.pickle', 'rb') as f:
    comp, rec = pickle.load(f)
X = comp + rec
Y = [0] * len(comp) + [1] * len(rec)

lda = KtLDA(n_components=2, alpha=0.5, beta=0.5, iterations=10, max_vocab=5000, random_state=663)
lda.fit(X)
print(lda.doc_topic_dist)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ktLDA-0.0.6.tar.gz (108.7 kB view hashes)

Uploaded Source

Built Distribution

ktLDA-0.0.6-cp37-cp37m-macosx_10_14_x86_64.whl (156.8 kB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page