Skip to main content

Library for evaluating and deploying human readable machine learning explanations.

Project description

“DAI-Lab” An open source project from Data to AI Lab at MIT.

PyPI Shield

Build Action Status

Pyreal

Library for generating useful and usable machine learning explanations.

Overview

Pyreal wraps the complete machine learning explainability pipeline into RealApp objects, which seamlessly provide usable explanations in a low-code manner.

Install

Requirements

Pyreal has been developed and tested on Python 3.9, 3.10, and 3.11 The library uses Poetry for package management.

Install from PyPI

We recommend using pip in order to install Pyreal:

pip install pyreal

This will pull and install the latest stable release from PyPI.

Install from source

If you do not have poetry installed, please head to poetry installation guide and install poetry according to the instructions.
Run the following command to make sure poetry is activated. You may need to close and reopen the terminal.

poetry --version

Finally, you can clone this repository and install it from source by running poetry install, with the optional examples extras if you'd like to run our tutorial scripts.

git clone https://github.com/sibyl-dev/pyreal.git
cd pyreal
poetry install

Install for Development

If you want to contribute to the project, a few more steps are required to make the project ready for development.

Please head to the Contributing Guide for more details about this process.

Quickstart

In this short tutorial we will guide you through a series of steps that will help you getting started with Pyreal. We will get an explanation for a prediction on whether a passenger on the Titanic would have survived.

For a more detailed version of this tutorial, see our documentation.

Load in the demo data and application

>>> import pyreal.sample_applications.titanic as titanic

>>> real_app = titanic.load_app()
>>> sample_data = titanic.load_data(n_rows=300)

Predict and produce explanation

>>> predictions = real_app.predict(sample_data)

>>> explanation = real_app.produce_feature_contributions(sample_data)

Visualize explanation for one passenger

passenger_id = 1
feature_bar_plot(explanation[passenger_id], prediction=predictions[passenger_id], show=False)

The output will be a bar plot showing the most contributing features, by absolute value.

Quickstart

We can see here that the input passenger's predicted chance of survival was greatly reduced because of their sex (male) and ticket class (3rd class).

Troubleshoot

For macOS users, an error regarding lightgbm might arise when running the titanic tutorial due to lack of lightgbm installation. If this occurs, please run the following line in your terminal to install lightgbm.

brew install lightgbm

Terminology

Pyreal introduces specific terms and naming schemes to refer to different feature spaces and transformations. The Terminology User Guide provides an introduction to these terms.

What's next?

For more details about Pyreal and all its possibilities and features, please check the documentation site.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyreal-0.4.6.tar.gz (950.8 kB view details)

Uploaded Source

Built Distribution

pyreal-0.4.6-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file pyreal-0.4.6.tar.gz.

File metadata

  • Download URL: pyreal-0.4.6.tar.gz
  • Upload date:
  • Size: 950.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pyreal-0.4.6.tar.gz
Algorithm Hash digest
SHA256 e9f6c98d0dbc4576a3562a05ba2c36aa470a0bf399835cda7745de80b4d1e3e7
MD5 a34e3c713547228d6210a606a9991563
BLAKE2b-256 e2a26bd163e81c2b156dc29767ec3558e8ada28ee91c4b81d9b49e1d444ddcc6

See more details on using hashes here.

File details

Details for the file pyreal-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: pyreal-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pyreal-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9a6c62a0c22abdc8f24bd553e94a91412bb82721ec332f77fbb689c992526df9
MD5 dbd9f04c76cf7e45daa0b192a28460ef
BLAKE2b-256 ea7d30a2af4a2887ad65f57061cf67ac2a2f51e7a3043f1e7851fe4971ab2b03

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page