pyreal


Namepyreal JSON
Version 0.4.10 PyPI version JSON
download
home_pagehttps://sibyl-ml.dev/
SummaryLibrary for evaluating and deploying human readable machine learning explanations.
upload_time2024-08-05 17:58:34
maintainerMIT Data To AI Lab
docs_urlNone
authorAlexandra Zytek
requires_python<3.12,>=3.9
licenseNone
keywords pyreal pyreal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="left">
<img width=15% src="https://dai.lids.mit.edu/wp-content/uploads/2018/06/Logo_DAI_highres.png" alt=“DAI-Lab” />
<i>An open source project from Data to AI Lab at MIT.</i>
</p>

<!-- Uncomment these lines after releasing the package to PyPI for version and downloads badges -->

[![PyPI Shield](https://img.shields.io/pypi/v/pyreal.svg)](https://pypi.python.org/pypi/pyreal)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyreal)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pyreal)](https://pypi.python.org/pypi/pyreal)
[![Build Action Status](https://github.com/DAI-Lab/pyreal/workflows/Test%20CI/badge.svg)](https://github.com/DAI-Lab/pyreal/actions)
[![Static Badge](https://img.shields.io/badge/slack-sibyl-purple?logo=slack)](https://join.slack.com/t/sibyl-ml/shared_invite/zt-2dyfwbgo7-2ALinuT2KDZpsVJ4rntJuA)
<!--[![Travis CI Shield](https://travis-ci.org/DAI-Lab/pyreal.svg?branch=stable)](https://travis-ci.org/DAI-Lab/pyreal)-->
<!--[![Coverage Status](https://codecov.io/gh/DAI-Lab/pyreal/branch/stable/graph/badge.svg)](https://codecov.io/gh/DAI-Lab/pyreal)-->

# Pyreal

An easier approach to understanding your model's predictions.

| Important Links                               |                                                                      |
| --------------------------------------------- | -------------------------------------------------------------------- |
| :book: **[Documentation]**                    | Quickstarts and user guides                                          |
| :memo: **[API Reference]**                    | Full library API                                                     |
| :apple: **[Tutorials]**                       | Notebooks with example usage                                          |
| :scroll: **[License]**                        | This repository is published under the MIT License                    |
| :computer: **[Project Homepage]**             | Check out the Sibyl project website for more information             |

[Project Homepage]: https://sibyl-ml.dev/
[Documentation]: https://dtail.gitbook.io/pyreal/
[Tutorials]: https://github.com/sibyl-dev/pyreal/tree/dev/tutorials
[License]: https://github.com/sibyl-dev/pyreal/blob/dev/LICENSE
[Community]: https://join.slack.com/t/sibyl-ml/shared_invite/zt-2dyfwbgo7-2ALinuT2KDZpsVJ4rntJuA
[API Reference]: https://sibyl-ml.dev/pyreal/api_reference/index.html

# Overview

**Pyreal** gives you easy-to-understand explanations of your machine learning models in a low-code manner.
Pyreal wraps full ML pipelines in a RealApp object that makes it easy to use, understand, and interact with your ML model — regardless of your ML expertise.

See our tutorial series for an example of using Pyreal for house-price prediction:
- [Part 1: Learn about feature engineering and modelling](https://medium.com/mit-data-to-ai-lab/using-and-understanding-machine-learning-ml-models-ada6525cf192)
- [Part 2: Learn how to use Pyreal to use and understand ML models ](https://medium.com/mit-data-to-ai-lab/using-and-understanding-machine-learning-ml-models-0ce7c227837e) 

# Install

## Requirements

**Pyreal** has been developed and tested on [Python 3.9, 3.10, and 3.11](https://www.python.org/downloads/)
The library uses Poetry for package management.

## Install from PyPI

We recommend using
[pip](https://pip.pypa.io/en/stable/) in order to install **Pyreal**:

```
pip install pyreal
```

This will pull and install the latest stable release from [PyPI](https://pypi.org/project/pyreal/).

## Install from source

If you do not have **poetry** installed, please head to [poetry installation guide](https://python-poetry.org/docs/#installation)
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](https://dtail.gitbook.io/pyreal/developer-guides/contributing-to-pyreal)
for more details about this process.

# Quickstart

In this short tutorial we will guide you through some steps to get your started with **Pyreal**.
We will use a RealApp object to get predictions and explanations on whether a passenger on the Titanic would have survived.

For a more detailed version of this tutorial, see [our documentation](https://dtail.gitbook.io/pyreal/getting-started/quickstart).

#### Load in the demo data and application

```python
import pyreal.sample_applications.titanic as titanic

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

```

#### Predict and produce explanation

```python
predictions = real_app.predict(sample_data)

explanation = real_app.produce_feature_contributions(sample_data)

```

#### Visualize explanation for one passenger

```python
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](docs/images/titanic.png)

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).

### Migrating your application to Pyreal
To create a RealApp object for your own application,
see our [migration tutorial](https://github.com/sibyl-dev/pyreal/blob/dev/tutorials/migrating_to_pyreal.ipynb).

For basic applications built on `sklearn` pipelines, you may be able to simply use:
```python
from pyreal import RealApp

pipeline = # YOUR SKLEARN PIPELINE
X_train, y_train = # YOUR TRAINING DATA

real_app = RealApp.from_sklearn(pipeline, X_train=X_train, y_train=y_train)
```

# Next Steps

For more information on using **Pyreal** for your use case, head over to the full [documentation site](https://dtail.gitbook.io/pyreal/getting-started/next-steps).


            

Raw data

            {
    "_id": null,
    "home_page": "https://sibyl-ml.dev/",
    "name": "pyreal",
    "maintainer": "MIT Data To AI Lab",
    "docs_url": null,
    "requires_python": "<3.12,>=3.9",
    "maintainer_email": "dailabmit@gmail.com",
    "keywords": "pyreal, Pyreal",
    "author": "Alexandra Zytek",
    "author_email": "zyteka@mit.edu",
    "download_url": "https://files.pythonhosted.org/packages/cd/dd/b6ffcd3034d4e902af8335e5d862f80b992b4ffcb7d6c3367df9de5cf045/pyreal-0.4.10.tar.gz",
    "platform": null,
    "description": "<p align=\"left\">\n<img width=15% src=\"https://dai.lids.mit.edu/wp-content/uploads/2018/06/Logo_DAI_highres.png\" alt=\u201cDAI-Lab\u201d />\n<i>An open source project from Data to AI Lab at MIT.</i>\n</p>\n\n<!-- Uncomment these lines after releasing the package to PyPI for version and downloads badges -->\n\n[![PyPI Shield](https://img.shields.io/pypi/v/pyreal.svg)](https://pypi.python.org/pypi/pyreal)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyreal)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pyreal)](https://pypi.python.org/pypi/pyreal)\n[![Build Action Status](https://github.com/DAI-Lab/pyreal/workflows/Test%20CI/badge.svg)](https://github.com/DAI-Lab/pyreal/actions)\n[![Static Badge](https://img.shields.io/badge/slack-sibyl-purple?logo=slack)](https://join.slack.com/t/sibyl-ml/shared_invite/zt-2dyfwbgo7-2ALinuT2KDZpsVJ4rntJuA)\n<!--[![Travis CI Shield](https://travis-ci.org/DAI-Lab/pyreal.svg?branch=stable)](https://travis-ci.org/DAI-Lab/pyreal)-->\n<!--[![Coverage Status](https://codecov.io/gh/DAI-Lab/pyreal/branch/stable/graph/badge.svg)](https://codecov.io/gh/DAI-Lab/pyreal)-->\n\n# Pyreal\n\nAn easier approach to understanding your model's predictions.\n\n| Important Links                               |                                                                      |\n| --------------------------------------------- | -------------------------------------------------------------------- |\n| :book: **[Documentation]**                    | Quickstarts and user guides                                          |\n| :memo: **[API Reference]**                    | Full library API                                                     |\n| :apple: **[Tutorials]**                       | Notebooks with example usage                                          |\n| :scroll: **[License]**                        | This repository is published under the MIT License                    |\n| :computer: **[Project Homepage]**             | Check out the Sibyl project website for more information             |\n\n[Project Homepage]: https://sibyl-ml.dev/\n[Documentation]: https://dtail.gitbook.io/pyreal/\n[Tutorials]: https://github.com/sibyl-dev/pyreal/tree/dev/tutorials\n[License]: https://github.com/sibyl-dev/pyreal/blob/dev/LICENSE\n[Community]: https://join.slack.com/t/sibyl-ml/shared_invite/zt-2dyfwbgo7-2ALinuT2KDZpsVJ4rntJuA\n[API Reference]: https://sibyl-ml.dev/pyreal/api_reference/index.html\n\n# Overview\n\n**Pyreal** gives you easy-to-understand explanations of your machine learning models in a low-code manner.\nPyreal wraps full ML pipelines in a RealApp object that makes it easy to use, understand, and interact with your ML model \u2014 regardless of your ML expertise.\n\nSee our tutorial series for an example of using Pyreal for house-price prediction:\n- [Part 1: Learn about feature engineering and modelling](https://medium.com/mit-data-to-ai-lab/using-and-understanding-machine-learning-ml-models-ada6525cf192)\n- [Part 2: Learn how to use Pyreal to use and understand ML models ](https://medium.com/mit-data-to-ai-lab/using-and-understanding-machine-learning-ml-models-0ce7c227837e) \n\n# Install\n\n## Requirements\n\n**Pyreal** has been developed and tested on [Python 3.9, 3.10, and 3.11](https://www.python.org/downloads/)\nThe library uses Poetry for package management.\n\n## Install from PyPI\n\nWe recommend using\n[pip](https://pip.pypa.io/en/stable/) in order to install **Pyreal**:\n\n```\npip install pyreal\n```\n\nThis will pull and install the latest stable release from [PyPI](https://pypi.org/project/pyreal/).\n\n## Install from source\n\nIf you do not have **poetry** installed, please head to [poetry installation guide](https://python-poetry.org/docs/#installation)\nand install poetry according to the instructions.\\\nRun the following command to make sure poetry is activated. You may need to close and reopen the terminal.\n\n```\npoetry --version\n```\n\nFinally, you can clone this repository and install it from\nsource by running `poetry install`, with the optional `examples` extras if you'd like to run our tutorial scripts.\n\n```\ngit clone https://github.com/sibyl-dev/pyreal.git\ncd pyreal\npoetry install\n```\n\n## Install for Development\n\nIf you want to contribute to the project, a few more steps are required to make the project ready\nfor development.\n\nPlease head to the [Contributing Guide](https://dtail.gitbook.io/pyreal/developer-guides/contributing-to-pyreal)\nfor more details about this process.\n\n# Quickstart\n\nIn this short tutorial we will guide you through some steps to get your started with **Pyreal**.\nWe will use a RealApp object to get predictions and explanations on whether a passenger on the Titanic would have survived.\n\nFor a more detailed version of this tutorial, see [our documentation](https://dtail.gitbook.io/pyreal/getting-started/quickstart).\n\n#### Load in the demo data and application\n\n```python\nimport pyreal.sample_applications.titanic as titanic\n\nreal_app = titanic.load_app()\nsample_data = titanic.load_data(n_rows=300)\n\n```\n\n#### Predict and produce explanation\n\n```python\npredictions = real_app.predict(sample_data)\n\nexplanation = real_app.produce_feature_contributions(sample_data)\n\n```\n\n#### Visualize explanation for one passenger\n\n```python\npassenger_id = 1\nfeature_bar_plot(explanation[passenger_id], prediction=predictions[passenger_id], show=False)\n\n```\n\nThe output will be a bar plot showing the most contributing features, by absolute value.\n\n![Quickstart](docs/images/titanic.png)\n\nWe can see here that the input passenger's predicted chance of survival was greatly reduced\nbecause of their sex (male) and ticket class (3rd class).\n\n### Migrating your application to Pyreal\nTo create a RealApp object for your own application,\nsee our [migration tutorial](https://github.com/sibyl-dev/pyreal/blob/dev/tutorials/migrating_to_pyreal.ipynb).\n\nFor basic applications built on `sklearn` pipelines, you may be able to simply use:\n```python\nfrom pyreal import RealApp\n\npipeline = # YOUR SKLEARN PIPELINE\nX_train, y_train = # YOUR TRAINING DATA\n\nreal_app = RealApp.from_sklearn(pipeline, X_train=X_train, y_train=y_train)\n```\n\n# Next Steps\n\nFor more information on using **Pyreal** for your use case, head over to the full [documentation site](https://dtail.gitbook.io/pyreal/getting-started/next-steps).\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Library for evaluating and deploying human readable machine learning explanations.",
    "version": "0.4.10",
    "project_urls": {
        "Documentation": "https://sibyl-dev.github.io/pyreal",
        "Homepage": "https://sibyl-ml.dev/",
        "Repository": "https://github.com/DAI-Lab/pyreal"
    },
    "split_keywords": [
        "pyreal",
        " pyreal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb89c00be3aa7b9d11257c39ab7f66e656597f95776826e608e63faf74aa8d99",
                "md5": "e101e4b428e8bedc9afc4a074187db93",
                "sha256": "4205a6d129be3ba3528b8023e72566bc13de0c57fb24fc25b4e77fc12123011e"
            },
            "downloads": -1,
            "filename": "pyreal-0.4.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e101e4b428e8bedc9afc4a074187db93",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.9",
            "size": 1073069,
            "upload_time": "2024-08-05T17:58:32",
            "upload_time_iso_8601": "2024-08-05T17:58:32.439876Z",
            "url": "https://files.pythonhosted.org/packages/fb/89/c00be3aa7b9d11257c39ab7f66e656597f95776826e608e63faf74aa8d99/pyreal-0.4.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cdddb6ffcd3034d4e902af8335e5d862f80b992b4ffcb7d6c3367df9de5cf045",
                "md5": "44791f4a9c28988b7761ed31c996eff6",
                "sha256": "e1f5d60ed29467bbb34391248c37df038fd35ba033e38e85fb4e19744290a6a8"
            },
            "downloads": -1,
            "filename": "pyreal-0.4.10.tar.gz",
            "has_sig": false,
            "md5_digest": "44791f4a9c28988b7761ed31c996eff6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.9",
            "size": 984287,
            "upload_time": "2024-08-05T17:58:34",
            "upload_time_iso_8601": "2024-08-05T17:58:34.043485Z",
            "url": "https://files.pythonhosted.org/packages/cd/dd/b6ffcd3034d4e902af8335e5d862f80b992b4ffcb7d6c3367df9de5cf045/pyreal-0.4.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-05 17:58:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DAI-Lab",
    "github_project": "pyreal",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyreal"
}
        
Elapsed time: 3.99321s