vsm.model.BeagleEnvironment

class vsm.model.BeagleEnvironment(corpus, n_cols=2048, dtype=<type 'numpy.float64'>, context_type='sentence')

BeagleEnvironment is a randomly generated fixed vectors representing the environment.

Methods

__init__(corpus[, n_cols, dtype, context_type]) Initialize BeagleEnvironment.
load(f) Takes a filename or file object and loads it as an npz archive
save(f) Takes a filename or file object and saves self.matrix in an npz archive.
train() Sets a m x n environment matrix where m is the number of words in corpus and n is n_cols.
__init__(corpus, n_cols=2048, dtype=<type 'numpy.float64'>, context_type='sentence')

Initialize BeagleEnvironment.

Parameters:
  • corpus (Corpus) – Source of observed data.
  • n_cols (int, optional) – Number of columns. Default is 2048.
  • dtype (np.dtype, optional) – Numpy dtype for matrix attribute. Default is np.float64.
  • context_type (string, optional) – Name of tokenization stored in corpus whose tokens will be treated as documents. Default is sentence.
static load(f)

Takes a filename or file object and loads it as an npz archive into a BaseModel object.

Parameters:file (str-like or file-like object) – Designates the file to read. If file is a string ending in .gz, the file is first gunzipped. See numpy.load for further details.
Returns:A dictionary storing the data found in file.
See Also:numpy.load()
save(f)

Takes a filename or file object and saves self.matrix in an npz archive.

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

Sets a m x n environment matrix where m is the number of words in corpus and n is n_cols. The matrix consists of randomly generated vectors.

Previous topic

vsm.model.BeagleContextSeq

Next topic

vsm.model.BeagleOrderMulti

This Page