Skip to main content

SLISEMAP: Combine local explanations with supervised dimensionality reduction

Project description

PyPI Documentation Tests Licence: MIT Code style: black Binder DOI

SLISEMAP: Combine supervised dimensionality reduction with local explanations

SLISEMAP is a supervised dimensionality reduction method, that takes data, in the form of vectors, and predictions from a "black box" regression or classification model as input. SLISEMAP then simultaneously finds local explanations for all data items and builds a (typically) two-dimensional global visualisation of the black box model such that data items with similar local explanations are projected nearby. The explanations consists of interpretable models that locally approximate the "black box" model.

SLISEMAP is implemented in Python using PyTorch for efficient optimisation, and optional GPU-acceleration. For more information see the papers, the examples, or the documentation.

This library also includes the faster SLIPMAP variant, that uses "prototypes" to speed up the calculations (linear time and memory complexity instead of quadratic). SLIPMAP is largely compatible with SLISEMAP, just change the class name (Slisemap to Slipmap, see example below).

Citations

The new SLIPMAP paper (supplements and slides):

Björklund, A., Seppäläinen, L., & Puolamäki, K. (2024).
SLIPMAP: Fast and Robust Manifold Visualisation for Explainable AI
Advances in Intelligent Data Analysis XXII, IDA 2024, pp. 223-235. Lecture Notes in Computer Science, vol 14642. DOI: 10.1007/978-3-031-58553-1_18

The full SLISEMAP paper (arXiv, supplements, and slides):

Björklund, A., Mäkelä, J., & Puolamäki, K. (2023).
SLISEMAP: Supervised dimensionality reduction through local explanations.
Machine Learning 112, 1-43. DOI: 10.1007/s10994-022-06261-1

The short demo paper (video and slides):

Björklund, A., Mäkelä, J., & Puolamäki, K. (2023).
SLISEMAP: Combining Supervised Dimensionality Reduction with Local Explanations.
Machine Learning and Knowledge Discovery in Databases, ECML PKDD 2022. Lecture Notes in Computer Science, vol 13718. DOI: 10.1007/978-3-031-26422-1_41.

Installation

To install the package just run:

pip install slisemap

Or install the latest version directly from GitHub:

pip install git+https://github.com/edahelsinki/slisemap

To use the built-in hyperparameter tuning you also need scikit-optimize, which is automatically installed if you do:

pip install slisemap[tuning]

PyTorch

Since SLISEMAP utilises PyTorch for efficient calculations, you might want to install a version that is optimised for your hardware. See https://pytorch.org/get-started/locally for details.

Example

import numpy as np
from slisemap import Slisemap

X = np.array(...)
y = np.array(...)
sm = Slisemap(X, y, radius=3.5, lasso=0.01)
sm.optimise()
sm.plot(clusters=5, bars=5)

Example plot of the results from using SLISEMAP on the Auto MPG dataset

To use the faster SLIPMAP variant just replace the relevant lines:

from slisemap import Slipmap
sm = Slipmap(X, y, radius=2.0, lasso=0.01)

See the examples for more detailed examples, and the documentation for more detailed instructions.

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

slisemap-1.6.2.tar.gz (69.4 kB view details)

Uploaded Source

Built Distribution

slisemap-1.6.2-py3-none-any.whl (63.4 kB view details)

Uploaded Python 3

File details

Details for the file slisemap-1.6.2.tar.gz.

File metadata

  • Download URL: slisemap-1.6.2.tar.gz
  • Upload date:
  • Size: 69.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for slisemap-1.6.2.tar.gz
Algorithm Hash digest
SHA256 3d16e772ac3b5f75e427e802edd3443e116f87075523184578418386eea39b46
MD5 94d437c4c6b5da15f59304c1fb15bb87
BLAKE2b-256 a5214e946f31e94af3f7ef5ddf41d1e2ebd83ee65126a66220be8da8f1efb090

See more details on using hashes here.

File details

Details for the file slisemap-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: slisemap-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 63.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for slisemap-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 16cd857fcf2ec96e2501659939adae510c2af26197215fa4e9f17a0b94f1bc4a
MD5 43a0ade4cd390e9a7d1b867bb91b47a3
BLAKE2b-256 e42093a07039fa29d743a3f3c2a6c0e85bbae352a156ca83e2b103c466d12158

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