Skip to content

Visualization toolkit

topica.viz — manuscript-first panels with .to_frame() / .to_png() / .to_html() renderers, switching their statistics on a per-model capability descriptor. See the Visualization guide.

topica.viz.capabilities

capabilities(model) -> Capabilities

Infer the capability descriptor for a fitted model.

topica.viz.dashboard

dashboard() -- the convenience composite.

It introspects the capability descriptor and the arguments you pass to assemble the applicable panels: the topic-similarity heatmap and a term barchart always, the coherence frontier when texts is given, and the covariate effect plot when a design (formula/data or X) is given. .to_png() stacks the static panels; .to_html() writes a self-contained report (the interactive linked term/heatmap browser plus the static panels embedded as images); .to_frame() returns the numbers behind every panel.

__cached__ module-attribute

__cached__ = '/home/runner/work/topica/topica/python/topica/viz/__pycache__/dashboard.cpython-311.pyc'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__doc__ module-attribute

__doc__ = '``dashboard()`` -- the convenience composite.\n\nIt introspects the capability descriptor and the arguments you pass to assemble\nthe applicable panels: the topic-similarity heatmap and a term barchart always,\nthe coherence frontier when ``texts`` is given, and the covariate effect plot when\na design (``formula``/``data`` or ``X``) is given. ``.to_png()`` stacks the static\npanels; ``.to_html()`` writes a self-contained report (the interactive linked\nterm/heatmap browser plus the static panels embedded as images); ``.to_frame()``\nreturns the numbers behind every panel.\n'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__file__ module-attribute

__file__ = '/home/runner/work/topica/topica/python/topica/viz/dashboard.py'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__name__ module-attribute

__name__ = 'topica.viz.dashboard'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__package__ module-attribute

__package__ = 'topica.viz'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

Dashboard

__module__ class-attribute

__module__ = 'topica.viz.dashboard'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__weakref__ property

__weakref__

list of weak references to the object

to_frame

to_frame()

A dict of {panel_name: DataFrame}.

to_png

to_png(path: str | None = None, *, dpi: int = 150)

Compose the static panels into one figure with real subfigures, so the result stays vector (selectable text) for .pdf / .svg output.

to_html

to_html(path: str | None = None, *, title=None, mode='prob', n=10)

A self-contained HTML report: the interactive term/heatmap browser plus the static panels embedded as images.

CoherenceFrontier

Bases: topica.viz.base.Panel

Per-topic coherence vs exclusivity -- the figure authors use to defend dropping weak topics. Size encodes prevalence (by area).

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'Per-topic coherence vs exclusivity -- the figure authors use to defend\n    dropping weak topics. Size encodes prevalence (by area).'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.quality'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topic quality'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

ContentCovariate

Bases: topica.viz.base.Panel

One topic's wording across content-covariate groups, p(w | topic, group).

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = "One topic's wording across content-covariate groups, p(w | topic, group)."

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.content'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topic wording by group'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

contrast

contrast(model, group_a, group_b, *, n=10)

Convenience wrapper over the model's word_contrast for this topic: words that most distinguish how the topic is worded in group_a vs group_b.

matrix

matrix()

The words x groups probability matrix as a wide DataFrame.

to_frame

to_frame()

Long form: group, word, prob, and whether the word is in that group's own top-n.

DocumentInspector

Bases: topica.viz.base.Panel

One document: its θ mixture, its words shaded by topic, its neighbors.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'One document: its θ mixture, its words shaded by topic, its neighbors.'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.inspector'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

neighbors property

neighbors

The dominant topic's representative documents: [(idx, prop, text)].

theta property

theta

The document's topic proportions (a length-K array).

title class-attribute

title = 'Document inspector'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

to_frame

to_frame()

Per-token attribution: position, word, in_vocab, dominant_topic, p(topic | word, doc).

DocumentMap

Bases: topica.viz.base.Panel

A 2-D projection of the document cloud, colored by dominant topic.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'A 2-D projection of the document cloud, colored by dominant topic.'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.embedding_map'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

interactive class-attribute

interactive = True

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

title class-attribute

title = 'Document map'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

to_html

to_html(path=None, **kwargs)

An interactive Plotly scatter (WebGL), colored by dominant topic, with the outlier layer and per-point hover. Needs topica[viz].

EffectPlot

Bases: topica.viz.base.Panel

One covariate's effect on each topic's prevalence, with CIs.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = "One covariate's effect on each topic's prevalence, with CIs."

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.effect'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Covariate effect on topic prevalence'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

PrevalenceHeatmap

Bases: topica.viz.base.Panel

Mean topic prevalence within each level of a grouping variable.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'Mean topic prevalence within each level of a grouping variable.'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.groups'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topic prevalence by group'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

matrix

matrix()

The group x topic mean-prevalence matrix as a wide DataFrame.

TermBarchart

Bases: topica.viz.base.Panel

Top words of one topic, weighted by a named mode, with the corpus-frequency overlay. Optional inclusion-probability error bars (a bootstrap, so off by default).

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'Top words of one topic, weighted by a named mode, with the corpus-frequency\n    overlay. Optional inclusion-probability error bars (a bootstrap, so off by\n    default).'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.terms'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Top words'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

TopicCorrelation

Bases: topica.viz.base.Panel

A compositionally-aware topic-correlation heatmap (clr / partial / η-space / raw).

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'A compositionally-aware topic-correlation heatmap (clr / partial / η-space / raw).'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.correlation'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topic correlation'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

TopicHealth

Bases: topica.viz.base.Panel

Per-topic mass share with dead and duplicate topics flagged.

A topic is dead when its expected mass share falls below min_mass_frac (default 1%). A topic is a duplicate when its nearest neighbor in phi-cosine is at least dup_threshold similar (default 0.9); the two are reported as a pair. The bars are mass share, sorted, colored by flag.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'Per-topic mass share with dead and duplicate topics flagged.\n\n    A topic is **dead** when its expected mass share falls below ``min_mass_frac``\n    (default 1%). A topic is a **duplicate** when its nearest neighbor in phi-cosine\n    is at least ``dup_threshold`` similar (default 0.9); the two are reported as a\n    pair. The bars are mass share, sorted, colored by flag.\n    '

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.health'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topic health'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

duplicates

duplicates()

The near-duplicate topic pairs as [(a, b, cosine), ...] (each pair once, a < b), sorted by descending similarity.

TopicSimilarity

Bases: topica.viz.base.Panel

A seriated K x K topic-similarity heatmap -- every pairwise relationship at full fidelity, ordered by hierarchical clustering, no spurious metric plane.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = 'A seriated K x K topic-similarity heatmap -- every pairwise relationship at\n    full fidelity, ordered by hierarchical clustering, no spurious metric plane.'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.terms'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topic similarity'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

TopicsOverTime

Bases: topica.viz.base.Panel

Per-topic prevalence trajectories as small multiples.

For a dynamic :class:~topica.KeyATM with retained theta_draws, the CI ribbon is derived from the model's own HMM posterior via :func:topica.keyatm.time_prevalence_ci. For all other models, passing corpus= and nsims= produces a method-of-composition ribbon via :func:topica.keyatm.by_strata. See the module docstring for the difference.

__annotations__ class-attribute

__annotations__ = {}

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ class-attribute

__doc__ = "Per-topic prevalence trajectories as small multiples.\n\n    For a dynamic :class:`~topica.KeyATM` with retained ``theta_draws``, the CI\n    ribbon is derived from the model's own HMM posterior via\n    :func:`topica.keyatm.time_prevalence_ci`. For all other models, passing\n    ``corpus=`` and ``nsims=`` produces a method-of-composition ribbon via\n    :func:`topica.keyatm.by_strata`. See the module docstring for the difference.\n    "

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ class-attribute

__module__ = 'topica.viz.temporal'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

title class-attribute

title = 'Topics over time'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

dashboard

dashboard(model, texts=None, **kwargs) -> Dashboard

Assemble the applicable panels for a model into one report.

capabilities

capabilities(model) -> Capabilities

Infer the capability descriptor for a fitted model.

term_topic_browser

term_topic_browser(model, *, n=10, mode='prob')

An interactive (Plotly) term browser + topic-similarity heatmap: the seriated K x K heatmap for the overview, and a dropdown to pick a topic and read its top words. Returns an interactive view whose .to_html("page.html") writes a self-contained page (the wrapped Plotly figure is at .figure). Needs topica[viz].

topica.viz.coherence_frontier

coherence_frontier(model, texts=None, *, n=10, coherence_type=None) -> CoherenceFrontier

Per-topic coherence vs exclusivity (size = prevalence).

topica.viz.search_k

search_k(rows) -> SearchK

Coherence / exclusivity / perplexity across K. Pass topica.search_k(...) rows.

topica.viz.effect_plot

effect_plot(model, corpus=None, **kwargs) -> EffectPlot

One covariate's effect on each topic's prevalence, with well-calibrated CIs.

topica.viz.term_barchart

term_barchart(model, *, topic, mode='prob', n=10, texts=None, error_bars=False, **kwargs) -> TermBarchart

Top words of one topic as a weighted bar chart (mode = prob/frex/lift/...).

topica.viz.topic_similarity

topic_similarity(model, **kwargs) -> TopicSimilarity

Seriated K x K topic-similarity heatmap (the disciplined pyLDAvis overview).

topica.viz.topic_health

topic_health(model, *, min_mass_frac=0.01, dup_threshold=0.9) -> TopicHealth

Dead (near-zero-mass) and duplicate (near-identical φ) topics, flagged.

topica.viz.prevalence_heatmap

prevalence_heatmap(model, groups, **kwargs) -> PrevalenceHeatmap

Mean topic prevalence across the levels of a grouping variable.

topica.viz.topics_over_time

topics_over_time(model, timestamps, **kwargs) -> TopicsOverTime

Per-topic prevalence trajectories as small multiples (with optional CIs).

topica.viz.topic_correlation

topic_correlation(model, *, method='clr', **kwargs) -> TopicCorrelation

Compositionally-aware topic correlation (clr / partial / η-space / raw), 0-centered map.

topica.viz.document_map

document_map(model, doc_embeddings=None, *, method='pca', **kwargs) -> DocumentMap

A 2-D projection of the document cloud (PCA / UMAP / t-SNE), via the Rust core.

topica.viz.document_inspector

document_inspector(model, texts, *, doc, **kwargs) -> DocumentInspector

One document: its θ mixture, words shaded by topic attribution, neighbors.

topica.viz.content_covariate

content_covariate(model, *, topic, n=10) -> ContentCovariate

One topic's wording across STM/SAGE content-covariate groups, p(w|topic,group).

topica.viz.term_topic_browser

term_topic_browser(model, *, n=10, mode='prob')

An interactive (Plotly) term browser + topic-similarity heatmap: the seriated K x K heatmap for the overview, and a dropdown to pick a topic and read its top words. Returns an interactive view whose .to_html("page.html") writes a self-contained page (the wrapped Plotly figure is at .figure). Needs topica[viz].