plot_wordcloud
method plot_wordcloud(index=None, title=None, legend=None, figsize=(900, 600), filename=None, display=True, **kwargs)[source]
Plot a wordcloud from the corpus.
The text for the plot is extracted from the column named
corpus
. If there is no column with that name, an exception
is raised.
Parameters | index: int, str, slice, sequence or None, default=None
Documents in the corpus to include in the wordcloud. If
None, it selects all documents in the dataset.
title: str, dict or None, default=None
Title for the plot.
legend: str, dict or None, default=None
Does nothing. Implemented for continuity of the API.
figsize: tuple, default=(900, 600)
Figure's size in pixels, format as (x, y).
filename: str or None, default=None
Save the plot using this name. Use "auto" for automatic
naming. The type of the file depends on the provided name
(.html, .png, .pdf, etc...). If display: bool or None, default=Truefilename has no file type,
the plot is saved as html. If None, the plot is not saved.
Whether to render the plot. If None, it returns the figure.
**kwargs
Additional keyword arguments for the Wordcloud object.
|
Returns | go.Figure or None
Plot object. Only returned if display=None .
|
Example
>>> from atom import ATOMClassifier
>>> from sklearn.datasets import fetch_20newsgroups
>>> X, y = fetch_20newsgroups(
... return_X_y=True,
... categories=[
... 'alt.atheism',
... 'sci.med',
... 'comp.windows.x',
... ],
... shuffle=True,
... random_state=1,
... )
>>> X = np.array(X).reshape(-1, 1)
>>> atom = ATOMClassifier(X, y)
>>> atom.textclean()
>>> atom.textnormalize()
>>> atom.plot_wordcloud()