Skip to main content

Explingo

Explingo

Transform your ML explanations into human-friendly natural-language narratives.

NOTE: Explingo is still under active development and currently only supports a few basic explanation types and GPT-API models.

Installation

Explingo can be installed through PIP

pip install explingo

Usage

To transform explanations into narratives, you can use the Narrator class.

from explingo import Narrator, Grader 

example_narratives = [
    ("(Above ground living area square feet, 1256.00, -12527.46), (Overall material and finish of the house, 5.00, -10743.76), (Second floor square feet, 0.00, -10142.29)", 
     "The house's living area size of around 1,200 sq. ft., lower quality materials (5/10), and lack of a second floor are the main reasons for the low price."),
    ("(Second floor square feet, 854.00, 12757.84), (Original construction date, 2003.00, 9115.72)",
     "The house's large second floor of around 850 sq. ft and recent construction date of 2003 increases its value."),
    ("(Overall material and finish of the house, 8.00, 10743.76), (Above ground living area square feet, 2000.00, 12527.46), (Second floor square feet, 1000.00, 10142.29)",
        "The house's high quality materials (8/10), large living area size of around 2,000 sq. ft., and a second floor of around 1,000 sq. ft. are the main reasons for the high price."),
]

explanation_format = "(feature name, feature value, SHAP feature contribution)"
context = "The model predicts house prices"

narrator = Narrator(openai_api_key=[OPENAI_API_KEY], 
                    explanation_format=explanation_format,
                    context=context,
                    labeled_train_data=example_narratives)

explanation = "(number of bathrooms, 3, 7020), (number of bedrooms, 4, 12903)"

narrative = narrator.narrate(explanation)

To evaluate the quality of the generated narratives, you can use the Grader class.

grader = Grader(openai_api_key=[OPENAI_API_KEY], 
                metrics="all", 
                sample_narratives=[narrative[1] for narrative in example_narratives])

metrics = grader(explanation=explanation, 
                 explanation_format=explanation_format, 
                 narrative=narrative)

Metadata

Release files for explingo 0.1.1

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

Source distribution (sdist)

Source distribution for explingo 0.1.1
File Size Uploaded Provenance Actions
explingo-0.1.1.tar.gz 9.6 kB Without provenance Details for explingo-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for explingo 0.1.1
File Interpreter ABI Platform Actions
explingo-0.1.1-py3-none-any.whl Python 3 none any Details for explingo-0.1.1-py3-none-any.whl

Total release size: 20.3 kB

Release files / explingo-0.1.1.tar.gz

Download URL explingo-0.1.1.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7fb4c7866029e9476c471e11c2f4ea7baba0ce6a39ed25d1c22bfb722242c70e
BLAKE2b-256 checksum
How to use checksums
e108366082c46abe0a1e7b9a7bfd13e686211d29291dc96d4848f435c001bc34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / explingo-0.1.1-py3-none-any.whl

Download URL explingo-0.1.1-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e10573ae04fa569787461564706c4ed080b3d7c387ee8061d1796ece3f18c9cb
BLAKE2b-256 checksum
How to use checksums
310eba67a2e6347efa81be860613aa376654f0d0f166ccff324d07d47f4c64ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for explingo 0.1.1

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.

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