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 full SLISEMAP paper (arXiv and supplements):

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.

The new SLIPMAP paper (supplements):

Björklund, A., Seppäläinen, L., & Puolamäki, K. (2024).
SLIPMAP: Fast and Robust Manifold Visualisation for Explainable AI
To appear in: Advances in Intelligent Data Analysis XXII. IDA 2024. Lecture Notes in Computer Science.

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.1.tar.gz (69.3 kB view details)

Uploaded Source

Built Distribution

slisemap-1.6.1-py3-none-any.whl (63.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slisemap-1.6.1.tar.gz
  • Upload date:
  • Size: 69.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for slisemap-1.6.1.tar.gz
Algorithm Hash digest
SHA256 7d905fcb2882b3bacbeee834252346a3ba11c9b59e51fcf9257548ef8288ed5c
MD5 3f8eebba4d8b80af16eaff462f4e7ff6
BLAKE2b-256 9aa49c56ee6ba1e1d1aee777e7c02108585e8d7d01d908a504df76289f805e5f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slisemap-1.6.1-py3-none-any.whl
  • Upload date:
  • Size: 63.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for slisemap-1.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f358aba58845eb34e9538fcc678e3101163236a0474e4c117a51f44a6536ed5
MD5 8448cfe1eb23df6409ae234d1d62c79f
BLAKE2b-256 9b6ab1745e5acb0fce9ebaa0fdbb2c78089f2de51e88313a75b761e6873f6bc5

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