Metadata-Version: 2.1
Name: mlinspect
Version: 0.0.1.dev0
Summary: Inspect ML Pipelines in the form of a DAG
Home-page: UNKNOWN
Author: Stefan Grafberger
Author-email: stefangrafberger@gmail.com
License: Apache License 2.0
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: scikit-learn[alldeps] (==0.23.2)
Requires-Dist: pandas (==1.1.4)
Requires-Dist: nbformat (==5.0.8)
Requires-Dist: nbconvert (==6.0.7)
Requires-Dist: ipython (==7.19.0)
Requires-Dist: astunparse (==1.6.3)
Requires-Dist: astpretty (==2.0.0)
Requires-Dist: astmonkey (==0.3.6)
Requires-Dist: networkx (==2.5)
Requires-Dist: more-itertools (==8.6.0)
Requires-Dist: pygraphviz (==1.5)
Requires-Dist: testfixtures (==6.15.0)
Requires-Dist: matplotlib (==3.3.2)
Provides-Extra: dev
Requires-Dist: pylint (==2.6.0) ; extra == 'dev'
Requires-Dist: pytest (==6.1.2) ; extra == 'dev'
Requires-Dist: pytest-pylint (==0.17.0) ; extra == 'dev'
Requires-Dist: pytest-runner (==5.2) ; extra == 'dev'
Requires-Dist: pytest-cov (==2.10.1) ; extra == 'dev'
Requires-Dist: pytest-pycharm (==0.7.0) ; extra == 'dev'
Requires-Dist: pytest-mock (==3.3.1) ; extra == 'dev'
Requires-Dist: gensim (==3.8.3) ; extra == 'dev'
Requires-Dist: tensorflow (==2.3.1) ; extra == 'dev'
Requires-Dist: keras (==2.4.3) ; extra == 'dev'
Requires-Dist: jupyter (==1.0.0) ; extra == 'dev'
Requires-Dist: importnb (==0.6.2) ; extra == 'dev'
Requires-Dist: seaborn (==0.11.0) ; extra == 'dev'

mlinspect
================================

[![mlinspect](https://img.shields.io/badge/🔎-mlinspect-green)](https://github.com/stefan-grafberger/MLInspect)
[![GitHub license](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://github.com/stefan-grafberger/MLInspect/blob/master/LICENSE)
[![Build Status](https://travis-ci.com/stefan-grafberger/mlinspect.svg?token=x1zHsibRoiV8cZwxNVsj&branch=master)](https://travis-ci.com/stefan-grafberger/MLInspect)
[![codecov](https://codecov.io/gh/stefan-grafberger/MLInspect/branch/master/graph/badge.svg?token=KTMNPBV1ZZ)](https://codecov.io/gh/stefan-grafberger/MLInspect)

Inspect ML Pipelines in Python in the form of a DAG

## Run mlinspect locally

Prerequisite: python ==  3.8 (current blocker: sklearn does not support 3.9 yet it seems)

1. Clone this repository
2. Set up the environment

	`cd mlinspect` <br>
	`python -m venv venv` <br>
	`source venv/bin/activate` <br>

3. Install pip dependencies 

    `pip install -e .[dev]` <br>

4. If you want to use the visualisation functions we provide, install graphviz which can not be installed via pip

    `Linux: ` `apt-get install graphviz` <br>
    `MAC OS: ` `brew install graphviz` <br>

5. Run the tests

    `python setup.py test` <br>

## Vision
Make it easy to analyze your pipeline and automatically check for common issues.
```python
from mlinspect import PipelineInspector
from mlinspect.inspections import MaterializeFirstOutputRows
from mlinspect.checks import NoBiasIntroducedFor

IPYNB_PATH = ...

inspector_result = PipelineInspector\
        .on_pipeline_from_ipynb_file(IPYNB_PATH)\
        .add_required_inspection(MaterializeFirstOutputRows(5))\
        .add_check(NoBiasIntroducedFor(['race']))\
        .execute()

extracted_dag = inspector_result.dag
inspection_to_annotations = inspector_result.inspection_to_annotations
check_to_check_results = inspector_result.check_to_check_results
```

## Detailed Example
We prepared a [demo notebook](demo/feature_overview/feature_overview.ipynb) to showcase mlinspect and its features.

## Notes
* For debugging in PyCharm, set the pytest flag `--no-cov` ([Link](https://stackoverflow.com/questions/34870962/how-to-debug-py-test-in-pycharm-when-coverage-is-enabled))
* This is a research project, so comprehensive coverage of all possible ML APIs will not be possible in the current initial step. We will try to tell you if we encounter APIs we can not handle yet.

## License
This library is licensed under the Apache 2.0 License.


