slise


Nameslise JSON
Version 2.2.4 PyPI version JSON
download
home_pageNone
SummaryThe SLISE algorithm for robust regression and explanations of black box models
upload_time2024-05-11 12:01:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT License Copyright (c) 2022 Anton Björklund Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords robust regression sparse linear regression explainable artificial intelligence local explanations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![PySLISE Banner Image](docs/pyslise_banner.webp)  
[![PyPI](https://img.shields.io/pypi/v/slise)](https://pypi.org/project/slise/)
[![Documentation](https://github.com/edahelsinki/pyslise/actions/workflows/python-docs.yml/badge.svg)](https://edahelsinki.github.io/pyslise/docs/slise/)
[![Tests](https://github.com/edahelsinki/pyslise/actions/workflows/python-pytest.yml/badge.svg)](https://github.com/edahelsinki/pyslise/actions/workflows/python-pytest.yml)
[![License: MIT](https://img.shields.io/github/license/edahelsinki/pyslise)](https://github.com/edahelsinki/pyslise/blob/master/LICENSE)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/edahelsinki/pyslise/HEAD?labpath=examples)

# SLISE - Sparse Linear Subset Explanations

Python implementation of the SLISE algorithm. The SLISE algorithm can be used for both robust regression and to explain outcomes from black box models.
For more details see the [conference paper](https://rdcu.be/bVbda), the [robust regression paper](https://rdcu.be/cFRHD), or the [local explanation paper](https://doi.org/10.3389/fcomp.2023.1143904).
Alternatively for a more informal overview see [the presentation](https://github.com/edahelsinki/slise/raw/master/vignettes/presentation.pdf), or [the poster](https://github.com/edahelsinki/slise/raw/master/vignettes/poster.pdf).
Finally, for learning to use the python package there are several [examples](https://github.com/edahelsinki/pyslise/tree/master/examples/) and [the documentation](https://edahelsinki.github.io/pyslise/docs/slise/).

> *Björklund A., Henelius A., Oikarinen E., Kallonen K., Puolamäki K.* (2019)  
> **Sparse Robust Regression for Explaining Classifiers.**  
> Discovery Science (DS 2019).  
> Lecture Notes in Computer Science, vol 11828, Springer.  
> https://doi.org/10.1007/978-3-030-33778-0_27  

> *Björklund A., Henelius A., Oikarinen E., Kallonen K., Puolamäki K.* (2022).  
> **Robust regression via error tolerance.**  
> Data Mining and Knowledge Discovery.  
> https://doi.org/10.1007/s10618-022-00819-2  

> *Björklund A., Henelius A., Oikarinen E., Kallonen K., Puolamäki K.* (2023)  
> **Explaining any black box model using real data.**  
> Frontiers in Computer Science 5:1143904.  
> https://doi.org/10.3389/fcomp.2023.1143904  

## The idea

In robust regression we fit regression models that can handle data that contains outliers (see the example below for why outliers are problematic for normal regression). SLISE accomplishes this by fitting a model such that the largest possible subset of the data items have an error less than a given value. All items with an error larger than that are considered potential outliers and do not affect the resulting model.

SLISE can also be used to provide *local model-agnostic explanations* for outcomes from black box models. To do this we replace the ground truth response vector with the predictions from the complex model. Furthermore, we force the model to fit a selected item (making the explanation local). This gives us a local approximation of the complex model with a simpler linear model (this is similar to, e.g., [LIME](https://github.com/marcotcr/lime) and [SHAP](https://github.com/slundberg/shap)). In contrast to other methods SLISE creates explanations using real data (not some discretised and randomly sampled data) so we can be sure that all inputs are valid (i.e. in the correct data manifold, and follows the constraints used to generate the data, e.g., the laws of physics).

## Installation

To install this package just run:

```sh
pip install slise
```

Or install the latest version directly from GitHub:

```sh
pip install git+https://github.com/edahelsinki/pyslise
```

Alternatively you can download the repo and run `python -m build` to build a wheel, or `pip install .` to install it locally.

### Numba

SLISE uses [Numba](https://numba.pydata.org/) to speed up the calculations. You might want to install the optional libraries to get the most out of Numba:

```sh
pip install "slise[tbb]"
```

## Other implementations

The (original) **R** implementation can be found [here](https://github.com/edahelsinki/slise).

## Examples

Here are two quick examples of SLISE in action. For more detailed examples, with descriptions on how to create and interpret them, see the [examples](https://github.com/edahelsinki/pyslise/tree/master/examples) directory.

> ![Example of Robust Regression](docs/ex1.webp)  
> SLISE is a robust regression algorithm, which means that it is able to handle outliers. This is in contrast to, e.g., ordinary least-squares regression, which gives skewed results when outliers are present.

 
> ![Example of Explanation](docs/ex2.webp)  
> SLISE can also be used to explain outcomes from black box models by locally approximating the complex models with a simpler linear model.

## Dependencies

This implementation requires Python 3 and the following packages:

- matplotlib
- numba
- numpy
- PyLBFGS
- scipy

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "slise",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Robust regression, Sparse Linear Regression, Explainable Artificial Intelligence, Local Explanations",
    "author": null,
    "author_email": "Anton Bj\u00f6rklund <anton.bjorklund@helsinki.fi>",
    "download_url": "https://files.pythonhosted.org/packages/0d/ae/d377c8cf8a3ba04ec717b56136f65290c73ba1ba2d91e117b6a321e51917/slise-2.2.4.tar.gz",
    "platform": null,
    "description": "![PySLISE Banner Image](docs/pyslise_banner.webp)  \n[![PyPI](https://img.shields.io/pypi/v/slise)](https://pypi.org/project/slise/)\n[![Documentation](https://github.com/edahelsinki/pyslise/actions/workflows/python-docs.yml/badge.svg)](https://edahelsinki.github.io/pyslise/docs/slise/)\n[![Tests](https://github.com/edahelsinki/pyslise/actions/workflows/python-pytest.yml/badge.svg)](https://github.com/edahelsinki/pyslise/actions/workflows/python-pytest.yml)\n[![License: MIT](https://img.shields.io/github/license/edahelsinki/pyslise)](https://github.com/edahelsinki/pyslise/blob/master/LICENSE)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/edahelsinki/pyslise/HEAD?labpath=examples)\n\n# SLISE - Sparse Linear Subset Explanations\n\nPython implementation of the SLISE algorithm. The SLISE algorithm can be used for both robust regression and to explain outcomes from black box models.\nFor more details see the [conference paper](https://rdcu.be/bVbda), the [robust regression paper](https://rdcu.be/cFRHD), or the [local explanation paper](https://doi.org/10.3389/fcomp.2023.1143904).\nAlternatively for a more informal overview see [the presentation](https://github.com/edahelsinki/slise/raw/master/vignettes/presentation.pdf), or [the poster](https://github.com/edahelsinki/slise/raw/master/vignettes/poster.pdf).\nFinally, for learning to use the python package there are several [examples](https://github.com/edahelsinki/pyslise/tree/master/examples/) and [the documentation](https://edahelsinki.github.io/pyslise/docs/slise/).\n\n> *Bj\u00f6rklund A., Henelius A., Oikarinen E., Kallonen K., Puolam\u00e4ki K.* (2019)  \n> **Sparse Robust Regression for Explaining Classifiers.**  \n> Discovery Science (DS 2019).  \n> Lecture Notes in Computer Science, vol 11828, Springer.  \n> https://doi.org/10.1007/978-3-030-33778-0_27  \n\n> *Bj\u00f6rklund A., Henelius A., Oikarinen E., Kallonen K., Puolam\u00e4ki K.* (2022).  \n> **Robust regression via error tolerance.**  \n> Data Mining and Knowledge Discovery.  \n> https://doi.org/10.1007/s10618-022-00819-2  \n\n> *Bj\u00f6rklund A., Henelius A., Oikarinen E., Kallonen K., Puolam\u00e4ki K.* (2023)  \n> **Explaining any black box model using real data.**  \n> Frontiers in Computer Science 5:1143904.  \n> https://doi.org/10.3389/fcomp.2023.1143904  \n\n## The idea\n\nIn robust regression we fit regression models that can handle data that contains outliers (see the example below for why outliers are problematic for normal regression). SLISE accomplishes this by fitting a model such that the largest possible subset of the data items have an error less than a given value. All items with an error larger than that are considered potential outliers and do not affect the resulting model.\n\nSLISE can also be used to provide *local model-agnostic explanations* for outcomes from black box models. To do this we replace the ground truth response vector with the predictions from the complex model. Furthermore, we force the model to fit a selected item (making the explanation local). This gives us a local approximation of the complex model with a simpler linear model (this is similar to, e.g., [LIME](https://github.com/marcotcr/lime) and [SHAP](https://github.com/slundberg/shap)). In contrast to other methods SLISE creates explanations using real data (not some discretised and randomly sampled data) so we can be sure that all inputs are valid (i.e. in the correct data manifold, and follows the constraints used to generate the data, e.g., the laws of physics).\n\n## Installation\n\nTo install this package just run:\n\n```sh\npip install slise\n```\n\nOr install the latest version directly from GitHub:\n\n```sh\npip install git+https://github.com/edahelsinki/pyslise\n```\n\nAlternatively you can download the repo and run `python -m build` to build a wheel, or `pip install .` to install it locally.\n\n### Numba\n\nSLISE uses [Numba](https://numba.pydata.org/) to speed up the calculations. You might want to install the optional libraries to get the most out of Numba:\n\n```sh\npip install \"slise[tbb]\"\n```\n\n## Other implementations\n\nThe (original) **R** implementation can be found [here](https://github.com/edahelsinki/slise).\n\n## Examples\n\nHere are two quick examples of SLISE in action. For more detailed examples, with descriptions on how to create and interpret them, see the [examples](https://github.com/edahelsinki/pyslise/tree/master/examples) directory.\n\n> ![Example of Robust Regression](docs/ex1.webp)  \n> SLISE is a robust regression algorithm, which means that it is able to handle outliers. This is in contrast to, e.g., ordinary least-squares regression, which gives skewed results when outliers are present.\n\n&nbsp;\n> ![Example of Explanation](docs/ex2.webp)  \n> SLISE can also be used to explain outcomes from black box models by locally approximating the complex models with a simpler linear model.\n\n## Dependencies\n\nThis implementation requires Python 3 and the following packages:\n\n- matplotlib\n- numba\n- numpy\n- PyLBFGS\n- scipy\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Anton Bj\u00f6rklund  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "The SLISE algorithm for robust regression and explanations of black box models",
    "version": "2.2.4",
    "project_urls": {
        "documentation": "https://edahelsinki.fi/pyslise/docs/slise/",
        "homepage": "https://edahelsinki.fi/pyslise",
        "repository": "https://github.com/edahelsinki/pyslise.git"
    },
    "split_keywords": [
        "robust regression",
        " sparse linear regression",
        " explainable artificial intelligence",
        " local explanations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad0c3dd6ce6a2316e0ad4cf797f21ccefcfb83dec84c78b9e44e115be6b33c81",
                "md5": "632de4929d9c55d16cd9b56667d3cddd",
                "sha256": "2b42ff82a997148db192ee448b3a377487fefd1dcb326cef1fa9e0784d47da13"
            },
            "downloads": -1,
            "filename": "slise-2.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "632de4929d9c55d16cd9b56667d3cddd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 29678,
            "upload_time": "2024-05-11T12:01:18",
            "upload_time_iso_8601": "2024-05-11T12:01:18.718237Z",
            "url": "https://files.pythonhosted.org/packages/ad/0c/3dd6ce6a2316e0ad4cf797f21ccefcfb83dec84c78b9e44e115be6b33c81/slise-2.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0daed377c8cf8a3ba04ec717b56136f65290c73ba1ba2d91e117b6a321e51917",
                "md5": "5ab54c71743e3b7d8d13246dc7c7870e",
                "sha256": "c6dbece99029f6ead584aa985b7730f2142e9e3ea93ea1311922d0fa1a8c4b96"
            },
            "downloads": -1,
            "filename": "slise-2.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "5ab54c71743e3b7d8d13246dc7c7870e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 32295,
            "upload_time": "2024-05-11T12:01:19",
            "upload_time_iso_8601": "2024-05-11T12:01:19.874870Z",
            "url": "https://files.pythonhosted.org/packages/0d/ae/d377c8cf8a3ba04ec717b56136f65290c73ba1ba2d91e117b6a321e51917/slise-2.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-11 12:01:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "edahelsinki",
    "github_project": "pyslise",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "slise"
}
        
Elapsed time: 0.74029s