vsm.model.Lsa

class vsm.model.Lsa(td_matrix=array([], dtype=float64), context_type=None)

Methods

__init__([td_matrix, dtype, context_type]) Initialize Lsa.
load(f) Loads LSA model data from a numpy archive file with extension
save(f) Saves model data as a numpy archive file with extension npz.
train([k_factors]) Trains the model.
__init__(td_matrix=array([], dtype=float64), context_type=None)

Initialize Lsa.

Parameters:
  • td_matrix (np.array, optional) – Term-Document matrix. Default is an empty array.
  • context_type (string, optional) – Name of tokenization whose tokens will be treated as documents. Default is None.
static load(f)

Loads LSA model data from a numpy archive file with extension npz. The expected keys for the component matrices are word_matrix, eigenvalues and doc_matrix.

Parameters:f (str-like or file-like object) – Designates the file from which to load data. See numpy.load for further details.
Returns:a saved Lsa model.
See Also:numpy.load()
save(f)

Saves model data as a numpy archive file with extension npz. The keys for the component matrices are word_matrix, eigenvalues and doc_matrix.

Parameters:f (str-like or file-like object) – Designates the file to which to save data. See numpy.savez for further details.
See Also:numpy.savez()
train(k_factors=300)

Trains the model.

Parameters:k_factors (int, optional) – Default is 300.

Previous topic

vsm.model.LdaCgsMulti

Next topic

vsm.model.TfIdf

This Page