Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

mldissect

https://travis-ci.com/ml-libs/mldissect.svg?branch=master https://codecov.io/gh/ml-libs/mldissect/branch/master/graph/badge.svg Maintainability

mldissect is model agnostic predictions explainer, library can show contribution of each feature of your prediction value.

Features

  • Supports predictions explanations for classification and regression

  • Easy to use API.

  • Works with pandas and numpy

Installation

Installation process is simple, just:

$ pip install mldissect

Basic Usage

# lets train a model
boston = load_boston()
columns = list(boston.feature_names)
X, y = boston['data'], boston['target']
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=.2, random_state=seed
)

clf = LassoCV()
clf.fit(X_train, y_train)

# select first observation in test split
observation = X_test[0]
# RegressionExplainer uses training data or sample of training data
# for large dataset to figure out contributions of each feature
explainer = RegressionExplainer(clf, X_train, columns)
result = explainer.explain(observation)
# print/visualize explanation
explanation = Explanation(result)
explanation.print()

result:

+----------+---------+--------------------+
| Feature  | Value   | Contribution       |
+----------+---------+--------------------+
| baseline | -       | 22.611881188118804 |
| LSTAT    | 7.34    | 3.6872             |
| PTRATIO  | 16.9    | 1.3652             |
| CRIM     | 0.06724 | 0.2323             |
| B        | 375.21  | 0.1195             |
| RM       | 6.333   | 0.0411             |
| INDUS    | 3.24    | 0.0312             |
| CHAS     | 0.0     | 0.0                |
| NOX      | 0.46    | 0.0                |
| TAX      | 430.0   | -0.3794            |
| AGE      | 17.2    | -0.5127            |
| ZN       | 0.0     | -0.6143            |
| DIS      | 5.2146  | -1.0792            |
| RAD      | 4.0     | -1.0993            |
+----------+---------+--------------------+

Algorithm

Algorithm is based on ideas describe in paper “Explanations of model predictions with live and breakDown packages” https://arxiv.org/abs/1804.01955

Difference with pyBreakDown

pyBreakDown is similar project, but there is key differences:

  • mldissect is maintained

  • Has tests and good code coverage.

  • Classification is working properly.

  • Multi class support.

  • Top down approach is not implemented.

  • Friendly license.

Requirements

CHANGES

Metadata

Release files for mldissect 0.0.1a2

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

Source distribution (sdist)

Source distribution for mldissect 0.0.1a2
File Size Uploaded
mldissect-0.0.1a2.tar.gz 8.7 kB Details

Release files / mldissect-0.0.1a2.tar.gz

Download URL mldissect-0.0.1a2.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
76076b4cbe86a09c9e038785b62ec6ca18682fee9f2fccbc39711a09a1da7d86
BLAKE2b-256 checksum
How to use checksums
f0170a2c31d9a6d70c6347c3f254fa757fe5b60944dc19bb9af82b18d033ffd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

0.0.1a2 This release

1 release file

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