vsm.model.LdaCgsSeq

class vsm.model.LdaCgsSeq(corpus=None, context_type=None, K=20, V=0, alpha=[], beta=[])

An implementation of LDA using collapsed Gibbs sampling.

Methods

__init__([corpus, context_type, K, V, ...]) Initialize LdaCgsSeq.
load(filename) A static method for loading a saved LdaCgsMulti model.
save(filename) Saves the model in an .npz file.
train([n_iterations, verbose, seed]) Takes an optional argument, n_iterations and updates the model n_iterations times.
__init__(corpus=None, context_type=None, K=20, V=0, alpha=[], beta=[])

Initialize LdaCgsSeq.

Parameters:
  • corpus (Corpus) – Source of observed data.
  • context_type (string, optional) – Name of tokenization stored in corpus whose tokens will be treated as documents.
  • K (int, optional) – Number of topics. Default is 20.
  • beta (list, optional) – Topic priors. Default is 0.01 for all words.
  • alpha (list, optional) – Document priors. Default is a flat prior of 0.01 for all topics.
static load(filename)

A static method for loading a saved LdaCgsMulti model.

Parameters:filename (string) – Name of a saved model to be loaded.
Returns:m : LdaCgsMulti object
See Also:numpy.load
save(filename)

Saves the model in an .npz file.

Parameters:filename (string) – Name of a saved model to be loaded.
See Also:numpy.savez
train(n_iterations=100, verbose=1, seed=None)

Takes an optional argument, n_iterations and updates the model n_iterations times.

Parameters:
  • n_iterations (int, optional) – Number of iterations. Default is 100.
  • verbose (int, optional) – If 1, current number of iterations are printed out to notify the user. Default is 1.
  • seed (int, optional) – Seed for numpy’s RandomState. Default is None.

Previous topic

vsm.model.BeagleOrderSeq

Next topic

vsm.model.LdaCgsMulti

This Page