vsm.viewer.BeagleViewer

class vsm.viewer.BeagleViewer(corpus, model)

A class for viewing BEAGLE models.

Methods

__init__(corpus, model) Initialize BeagleViewer.
dismat_word(word_list[, dist_fn]) Calculates a distance matrix for a given list of words.
dist_word_word(word_or_words[, weights, ...]) Computes and sorts the distances between word(s) and every word.
__init__(corpus, model)

Initialize BeagleViewer.

Parameters:
  • corpus (Corpus) – Source of observed data.
  • model (BEAGLE model) – One of the Beagle objects.
dismat_word(word_list, dist_fn=<function angle at 0x4859c80>)

Calculates a distance matrix for a given list of words.

Parameters:
  • word_list (list of strings) – A list of words whose distance matrix is to be computed.
  • dist_fn (string, optional) – A distance function from functions in vsm.spatial. Default is angle().
Returns:

an instance of IndexedSymmArray. A n x n matrix containing floats where n is the number of words in word_list.

See Also:

vsm.viewer.wrappers.dismat_word()

dist_word_word(word_or_words, weights=[], filter_nan=True, print_len=10, as_strings=True, dist_fn=<function angle at 0x4859c80>, order='i')

Computes and sorts the distances between word(s) and every word.

Parameters:
  • word_or_words (string or list of strings) – Query word(s) to which distances are calculated.
  • weights (list of floating point, optional) – Specify weights for each query word in word_or_words. Default uses equal weights (i.e. arithmetic mean)
  • filter_nan (boolean, optional) – If True not a number entries are filtered. Default is True.
  • print_len (int, optional) – Number of words to be displayed. Default is 10.
  • as_strings (boolean, optional) – If True, returns a list of words as strings rather than their integer representations. Default is True.
  • dist_fn (string, optional) – A distance function from functions in vsm.spatial. Default is angle().
  • order (string, optional) – Order of sorting. ‘i’ for increasing and ‘d’ for decreasing order. Default is ‘i’.
Returns:

an instance of LabeledColumn. A 2-dim array containing words and their distances to word_or_words.

See Also:

vsm.viewer.wrappers.dist_word_word()

Previous topic

vsm.viewer.TfViewer

Next topic

vsm.viewer.LdaCgsViewer

This Page