Other

项目介绍

SeldonIO/alibi 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 Other 许可证,目前获得 2.7k 个 Star、269 次 Fork。

仓库全名
SeldonIO/alibi
开源许可证
Other
Star 数
2.7k
Fork 数
269
未关闭 Issue
161

README 摘要

[#github-license]: https://github.com/SeldonIO/alibi/blob/master/LICENSE [#pypi-package]: https://pypi.org/project/alibi/ [#conda-forge-package]: https://anaconda.org/conda-forge/alibi [#docs-package]: https://docs.seldon.io/projects/alibi/en/stable/ [#build-status]: https://github.com/SeldonIO/alibi/actions?query=workflow%3A%22CI%22 [#slack-channel]…

完整内容见 GitHub 原始 README 或本页 。

常见问题

alibi 用什么语言开发?

主要使用 Python 编写,采用 Other 许可证,目前有 2.7k 个 Star。

alibi 可以免费商用吗?

仓库标注的许可证为 Other,商用前请先阅读仓库 LICENSE 文件确认授权范围。

如何获取 alibi 的源码?

可以直接克隆仓库:git clone https://github.com/SeldonIO/alibi.git,默认分支为 master;安装与运行步骤见仓库 README。

alibi 最近还在维护吗?

仓库最近一次更新为 2025年10月17日,当前有 161 个未关闭 Issue;Star 数为 2.7k,可作为社区活跃度的参考。

简要分析

热度分
3239
价值分
1668
活跃状态
活跃

语言占比

Makefile
Python

Release

README

Alibi Logo

Build Status Documentation Status codecov PyPI - Python Version PyPI - Package Version Conda (channel only) GitHub - License Slack channel


Alibi is a source-available Python library aimed at machine learning model inspection and interpretation. The focus of the library is to provide high-quality implementations of black-box, white-box, local and global explanation methods for classification and regression models.

If you’re interested in outlier detection, concept drift or adversarial instance detection, check out our sister project alibi-detect.


Anchor explanations for images


Integrated Gradients for text


Counterfactual examples


Accumulated Local Effects

Table of Contents

Installation and Usage

Alibi can be installed from:

  • PyPI or GitHub source (with pip)
  • Anaconda (with conda/mamba)

With pip

  • Alibi can be installed from PyPI:

    pip install alibi
    
  • Alternatively, the development version can be installed:

    pip install git+https://github.com/SeldonIO/alibi.git 
    
  • To take advantage of distributed computation of explanations, install alibi with ray:

    pip install alibi[ray]
    
  • For SHAP support, install alibi as follows:

    pip install alibi[shap]
    

With conda

To install from conda-forge it is recommended to use mamba, which can be installed to the base conda enviroment with:

conda install mamba -n base -c conda-forge
  • For the standard Alibi install:

    mamba install -c conda-forge alibi
    
  • For distributed computing support:

    mamba install -c conda-forge alibi ray
    
  • For SHAP support:

    mamba install -c conda-forge alibi shap
    

Usage

The alibi explanation API takes inspiration from scikit-learn, consisting of distinct initialize, fit and explain steps. We will use the AnchorTabular explainer to illustrate the API:

from alibi.explainers import AnchorTabular

# initialize and fit explainer by passing a prediction function and any other required arguments
explainer = AnchorTabular(predict_fn, feature_names=feature_names, category_map=category_map)
explainer.fit(X_train)

# explain an instance
explanation = explainer.explain(x)

The explanation returned is an Explanation object with attributes meta and data. meta is a dictionary containing the explainer metadata and any hyperparameters and data is a dictionary containing everything related to the computed explanation. For example, for the Anchor algorithm the explanation can be accessed via explanation.data['anchor'] (or explanation.anchor). The exact details of available fields varies from method to method so we encourage the reader to become familiar with the types of methods supported.

Supported Methods

The following tables summarize the possible use cases for each method.

Model Explanations

Method Models Explanations Classification Regression Tabular Text Images Categorical features Train set required Distributed
ALE BB global ✔ ✔ ✔
Partial Dependence BB WB global ✔ ✔ ✔ ✔
PD Variance BB WB global ✔ ✔ ✔ ✔
Permutation Importance BB global ✔ ✔ ✔ ✔
Anchors BB local ✔ ✔ ✔ ✔ ✔ For Tabular
CEM BB* TF/Keras local ✔ ✔ ✔ Optional
Counterfactuals BB* TF/Keras local ✔ ✔ ✔ No
Prototype Counterfactuals BB* TF/Keras local ✔ ✔ ✔ ✔ Optional
Counterfactuals with RL BB local ✔ ✔ ✔ ✔ ✔
Integrated Gradients TF/Keras local ✔ ✔ ✔ ✔ ✔ ✔ Optional
Kernel SHAP BB local

global
✔ ✔ ✔ ✔ ✔ ✔
Tree SHAP WB local

global
✔ ✔ ✔ ✔ Optional
Similarity explanations WB local ✔ ✔ ✔ ✔ ✔ ✔ ✔

Model Confidence

These algorithms provide instance-specific scores measuring the model confidence for making a particular prediction.

Method Models Classification Regression Tabular Text Images Categorical Features Train set required
Trust Scores BB ✔ ✔ ✔(1) ✔(2) Yes
Linearity Measure BB ✔ ✔ ✔ ✔ Optional

Key:

  • BB - black-box (only require a prediction function)
  • BB* - black-box but assume model is differentiable
  • WB - requires white-box model access. There may be limitations on models supported
  • TF/Keras - TensorFlow models via the Keras API
  • Local - instance specific explanation, why was this prediction made?
  • Global - explains the model with respect to a set of instances
  • (1) - depending on model
  • (2) - may require dimensionality reduction

Prototypes

These algorithms provide a distilled view of the dataset and help construct a 1-KNN interpretable classifier.

Method Classification Regression Tabular Text Images Categorical Features Train set labels
ProtoSelect ✔ ✔ ✔ ✔ ✔ Optional

References and Examples

Citations

If you use alibi in your research, please consider citing it.

BibTeX entry:

@article{JMLR:v22:21-0017,
  author  = {Janis Klaise and Arnaud Van Looveren and Giovanni Vacanti and Alexandru Coca},
  title   = {Alibi Explain: Algorithms for Explaining Machine Learning Models},
  journal = {Journal of Machine Learning Research},
  year    = {2021},
  volume  = {22},
  number  = {181},
  pages   = {1-7},
  url     = {http://jmlr.org/papers/v22/21-0017.html}
}

评论

暂无评论