Skip to main content

Inspect ML Pipelines in the form of a DAG

Project description

mlinspect

mlinspect GitHub license Build Status codecov

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
    python -m venv venv
    source venv/bin/activate

  3. Install pip dependencies

    pip install -e .[dev]

  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
    MAC OS: brew install graphviz

  5. Run the tests

    python setup.py test

Vision

Make it easy to analyze your pipeline and automatically check for common issues.

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 to showcase mlinspect and its features.

Notes

  • For debugging in PyCharm, set the pytest flag --no-cov (Link)
  • 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.

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

mlinspect-0.0.1.dev0.tar.gz (59.4 kB view hashes)

Uploaded Source

Built Distribution

mlinspect-0.0.1.dev0-py3-none-any.whl (90.7 kB view hashes)

Uploaded Python 3

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