Algorithms for explaining machine learning models
This is a patch release fixing several bugs, updating dependencies and a change of license.
This is a patch release to support numpy >= 1.24
and scikit-learn >= 1.3.0
, and drop official support for Python 3.7.
This is a patch release to officially enable support for Python 3.11. This is the last release with official support for Python 3.7.
mypy
ignore commands (#874).torch
version to 2.x
(#893).scikit-image
version to 0.21.x
(#928).numba
version to 0.57.x
(#922).sphinx
version to 7.x
(#921).This is a patch release fixing several bugs, updating dependencies and adding some small extensions.
IntegratedGradients
layer selection to be specified with a custom callable (#894).reset_predictor
method for PartialDependence
explainer (#897).GradientSimilarity
explainer to allow models of any input type (#912).AnchorText
auto-regressive language model sampler updating input_ids
tensor (#895).AnchorTabular
length discrepancy between feature
and names
fields (#902).AnchorBaseBeam
unintended coverage update during the multi-armed bandit run (#919, #914).tensorflow
bumped to 2.12.x
(#896).pandas
bumped to >1.0.0, <3.0.0
(#899).pandas
version 2.x
deprecations (#908, #910).scikit-image
bumped to 0.20.x
(#882).attrs
bumped to 23.x
(#905).codecov
to use Github Actions and don't fail CI on coverage report upload failure due to rate limiting (#901, #913).mypy
version to >=1.0, <2.0
(#886).sphinx
version to 6.x
(#852).sphinx-design
version to 0.4.1
(#904).nbsphinx
version to 0.9.x
(#889).myst-parser
version to >=1.0, <2.0
(#887).twine
version to 4.x
(#620).pre-commit
version to 3.x
and update the config (#866).This is a patch release fixing several bugs.
np.object
in the codebase which was causing errors with numpy>=1.24
(#872, #890).cfrl_base.py
of the tensorflow
backend (#891)..reset_predictor
for KernelShap
and TreeShap
explainers (#880).KernelShap
to avoid saving the internal _explainer
object (#881).PermutationImportance
explainer implementing the permutation feature importance global explanations. Also included is a plot_permutation_importance
utility function for flexible plotting of the resulting feature importance scores (docs, #798).PartialDependenceVariance
explainer implementing partial dependence variance global explanations. Also included is a plot_pd_variance
utility function for flexible plotting of the resulting PD variance plots (docs, #758).GradientSimilarity
explainer now automatically handles sparse tensors in the model by converting the gradient tensors to dense ones before calculating similarity. This used to be a source of bugs when calculating similarity for models with embedding layers for which gradients tensors are sparse by default. Additionally, it now filters any non-trainable parameters and doesn't consider those in the calculation as no gradients exist. A warning is raised if any non-trainable layers or parameters are detected (#829).ALE
. The previous examples and documentation had some misleading claims; these have been removed and reworked with an emphasis on the mostly qualitative interpretation of ALE
plots (#838, #846).ProtoSelect
, allowing greater flexibility to the end user (#826).tensorflow
models used in CounterfactualRL
(#793).pytorch
models used in CounterfactualRL
(#799).ALE
plotting functionality (#816).PartialDependence
plotting functionality (#819).PartialDependenceVariance
plotting functionality (#820).PermutationImportance
plotting functionality (#824).ProtoSelect
plotting functionality (#841).datasets
subpackage (#814).pytest-cov
bumped to 4.x
(#794).pytest-xdist
bumped to 3.x
(#808).tox
bumped to 4.x
(#832).PartialDependence
and TreePartialDependence
explainers implementing partial dependence (PD) global explanations. Also included is a plot_pd
utility function for flexible plotting of the resulting PD plots (docs, #721).exceptions.NotFittedError
exception which is raised whenever a compulsory call to a fit
method has not been carried out. Specifically, this is now raised in AnchorTabular.explain
when AnchorTabular.fit
has been skipped (#732).AnchorTabular
where an error is raised during an explain
call if the instance contains a categorical feature value not seen in the training data (#742).grid_points
for the ALE
explainer (#731).Alibi*
prefix and standardised the *Error
suffix. Concretely:
exceptions.AlibiPredictorCallException
is now exceptions.PredictorCallError
exceptions.AlibiPredictorReturnTypeError
is now exceptions.PredictorReturnTypeError
. Backwards compatibility has been maintained by subclassing the new exception classes by the old ones, but these will likely be removed in a future version (#733).TreeShap
is used with more than 100 samples in the background dataset which is due to a limitation in the upstream shap
package (#710).scikit-learn
bumped to 1.0.0
mainly due to upcoming deprecations (#776).scikit-image
bumped to 0.17.2
to fix a possible bug when using the slic
segmentation function with AnchorImage
(#753).attrs
bumped to 22.x
(#727).tensorflow
bumped to 2.10.x
(#745).ray
bumped to 2.x
(#740).numba
bumped to 0.56.x
(#724).shap
bumped to 0.41.x
(#702).shap
example notebooks to recommend installing matplotlib==3.5.3
due to failure of shap
plotting functions with matplotlib==3.6.0
(#776).pytest-custom_exit_code
to let notebook CI pass when no notebooks are selected for tests (#728).README.md
in setup.py
to avoid a possible failure of installation for some users (#744).ray
tests (#756).3.10.x
version on CI has been pinned to 3.10.6
due to typechecking failures, pending a new release of mypy
(#761).test_changed_notebooks
workflow can now be triggered manually and is run on push/PR for any branch (#762).codecov
flags for more granular reporting of code coverage (#759).sphinx
bumped to 5.x
but capped at <5.1.0
to avoid CI failures (#722).myst-parser
bumped to 0.18.x
(#693).flake8
bumped to 5.x
(#729).ipykernel
bumped to 6.x
(#431).ipython
bumped to 8.x
(#572).pytest
bumped to 7.x
(#591).sphinx-design
bumped to 0.3.0
(#739).nbconvert
bumped to 7.x
(#738).This release introduces two new methods, a GradientSimilarity
explainer and a ProtoSelect
data summarisation algorithm.
GradientSimilarity
explainer for explaining predictions of gradient-based (PyTorch and TensorFlow) models by returning the most similar training data points from the point of view of the model (docs).alibi.prototypes
which contains the ProtoSelect
algorithm for summarising datasets with a representative set of "prototypes" (docs).ALE
explainer now can take a custom grid-point per feature to evaluate the ALE
on. This can help in certain situations when grid-points defined by quantiles might not be the best choice (docs).IntegratedGradients
method target selection to handle explaining any scalar dimension of tensors of any rank (previously only rank-1 and rank-2 were supported). See #635.PyTorch
at the time of writing doesn't support Python 3.10 on Windows.CounterfactualProto
(#646).CounterfactualRLTabular
(#651).tensorflow
is now an optional dependency. To use methods that require tensorflow
you can install alibi
using pip install alibi[tensorflow]
which will pull in a supported version. For full instructions for the recommended way of installing optional dependencies please refer to Installation docs.sklearn
version bounds to scikit-learn>=0.22.0, <2.0.0
.tensorflow
maximum allowed version to 2.9.x
.MissingDependency
object. For full details on developing alibi
with optional dependencies see Contributing: Optional Dependencies.Explainer
base class into Base
and Explainer
to facilitate reusability and better class hierarchy semantics with introducing methods that are not explainers (#649).mypy
has been updated to ~=0.900
which requires additional development dependencies for type stubs, currently only types-requests
has been necessary to add to requirements/dev.txt
.doc/
and examples/
from the source distribution (by adding prune
directives in MANIFEST.in
). This results in considerably smaller file sizes for the source distribution.This is a patch release to correct a regression in CounterfactualProto
introduced in v0.6.3
.
v0.6.3
which prevented CounterfactualProto
working with categorical features (#612).LanguageModelSampler
where it would sometimes sample punctuation (#585).tensorflow
version has been bumped from 2.7 to 2.8 (#588).This is a patch release to correct a regression in AnchorImage
introduced in v0.6.3
.
v0.6.3
where AnchorImage
would ignore user segmentation_kwargs
(#581).Pillow
and scikit-image
have been bumped to 9.x and 0.19.x respectively.