mowl.visualization

mOWL TSNE

class mowl.visualization.base.TSNE(embeddings, labels, entities=None)[source]

Bases: Visualizer

Wrapper for sklearn.manifold.TSNE

Parameters:
  • embeddings (dict or gensim.models.keyedvectors.KeyedVectors) – Embeddings dictionary

  • labels (dict of {str: str}) – Dictionary containing label information of the entities

  • entities (list of str) – List of entities to consider for computing the TSNE. If None, then all the entitites in the embeddings dictionary will be considered.

generate_points(epochs, workers=1, verbose=0)[source]

This method will call the sklearn.manifold.TSNE.fit_transform() method to generate the points for the plot.

Parameters:
  • epochs (int) – Number of epochs to run the TSNE algorithm

  • workers (int, optional) – Number of workers to use for parallel processing. Defaults to 1.

  • verbose – Verbosity level. Defaults to 0.

show()[source]

This method will call the matplotlib.pyplot.show() method to show the plot.

savefig(outfile)[source]

This method will call the matplotlib.pyplot.savefig() method to save the plot. :param outfile: Path to the output file :type outfile: str