Skip to main content

trulens_viz

Visualize NLP results for human consumption

The nlp_viz.HTMLTable class takes phrases for which per-word attribution strenths are available. A phrase is provided to the class as a list of (word, attribution_score) tuples. Instances create a table with pairs of lines, one pair for each phrase. The first line shows the phrase's sequence of words, styled with one of two methods for communicating the word's attribution score: color, or size. The second line shows the attributions below each word.

NLP attribution strength demo

Installation

After cloning, and creation of a virtual environment:

pip install .

Usage

The above table display was created via this code:

word_attrs = [('foo', -10345), ('<s>', -3), ('bar', 6)]
tbl = HTMLTable(word_attrs, word_styling=WordStyles.FONT_COLOR)

# Add a second phrase, using fontsize as attribution score indicator:

tbl.add_rows([('My', -12345.), 
              ('Bonny', -100),
               ('lies', 0), 
               ('over', 100), 
               ('the', 500), 
               ('ocean', 10000.)],
              word_styling=WordStyles.FONT_SIZE)

# The third phrase, uses font color instead of size:

tbl.add_rows([('My', -12345.), 
              ('Bonny', -100),
               ('lies', 0), 
               ('over', 100), 
               ('the', 500), 
               ('ocean', 10000.)],
              word_styling=WordStyles.FONT_COLOR)

print(str(tbl.doc))

The printed string was transferred to a file, and opened in a browser. Alternatively, one can use the Python webbrowser package to open the file from code.

The code collects all scores, and sorts them into quantile bins (default is five bins). A word's bin membership determines the word's color or fontsize for display. Currently all attributions from all phrases in a table are used for quantiling. One could experiment with using only the strenghts within one phrase for that phrase's display.

Metadata

Release files for trulens-viz 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trulens-viz 0.0.2
File Size Uploaded Provenance
trulens_viz-0.0.2.tar.gz 10.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for trulens-viz 0.0.2
File Interpreter ABI Platform
trulens_viz-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / trulens_viz-0.0.2.tar.gz

Download URL trulens_viz-0.0.2.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f1e4dee0809a594f2ffd19c7beec850a2a35b68035b8551fb689e1398d47f927
BLAKE2b-256 checksum
How to use checksums
2fc469846817d55585bc20ff88c10a72ad3fcf9c7ef5e85ef4f9cfde864b6752
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / trulens_viz-0.0.2-py3-none-any.whl

Download URL trulens_viz-0.0.2-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd8f83e46606343b8055f2bdacb9fb30fc8d9158a1f0b0da43265bbbcc370f93
BLAKE2b-256 checksum
How to use checksums
5744613bdd57c421065473ad61460c643e9c021d5148277a50c97e61d315bb4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Security for trulens-viz 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page