How to use the tomotopy.TermWeight.ONE function in tomotopy

To help you get started, we’ve selected a few tomotopy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bab2min / tomotopy / View on Github external
def lda_example(input_file, save_path):
    mdl = tp.LDAModel(tw=tp.TermWeight.ONE, min_cf=3, rm_top=5, k=20)
    for n, line in enumerate(open(input_file, encoding='utf-8')):
        ch = line.strip().split()
    mdl.burn_in = 100
    print('Num docs:', len(, ', Vocab size:', mdl.num_vocabs, ', Num words:', mdl.num_words)
    print('Removed top words:', mdl.removed_top_words)
    print('Training...', file=sys.stderr, flush=True)
    for i in range(0, 1000, 10):
        print('Iteration: {}\tLog-likelihood: {}'.format(i, mdl.ll_per_word))

    print('Saving...', file=sys.stderr, flush=True), True)

    for k in range(mdl.k):


Tomoto, Topic Modeling Tool for Python

Latest version published 4 months ago

Package Health Score

71 / 100
Full package analysis

Similar packages