Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
33a34dd
vit: add image-attribution scaffolding (wrapper, granularity, explainer)
HugoDeBosschere May 26, 2026
ccb59dc
vit: add ImageSaliency and ImagePerturbator (first runnable attributi…
HugoDeBosschere May 27, 2026
8741303
added torchvision to the pyproject.toml because it's needed for image…
HugoDeBosschere May 27, 2026
6f5711b
added the possibility to store the raw image for the vizualisation
HugoDeBosschere May 27, 2026
77010c4
changed an import that I think was making the build fail
HugoDeBosschere May 27, 2026
7ef79be
added the possibility of showing the attributions on images and exten…
HugoDeBosschere May 27, 2026
dccfcac
added the base logic for EmbeddingsPerturbator and the specific Gauss…
HugoDeBosschere Jun 1, 2026
7f5dcab
added the specific logics for gradient_shap_image_perturbation and li…
HugoDeBosschere Jun 1, 2026
1141db8
added the base logic for masking perturbations on granularity element…
HugoDeBosschere Jun 1, 2026
5f42e57
new perturbation methods and new test with an actual vit
HugoDeBosschere Jun 2, 2026
bf7d67b
for sobol : we prefer the total order in image. for lime changed the …
HugoDeBosschere Jun 2, 2026
f8c8bb7
added the option to plot several different attribution techniques on …
HugoDeBosschere Jun 2, 2026
1b75f2b
modified the imports to correpond to the style checks (used to rely o…
HugoDeBosschere Jun 2, 2026
7e9cd22
modified the imports to correpond to the style checks (used to rely o…
HugoDeBosschere Jun 2, 2026
e4edfd3
same erros, same solutions
HugoDeBosschere Jun 2, 2026
0516b70
Removed the Model task attribute from ImageAttributionOutput and subs…
HugoDeBosschere Jun 8, 2026
b1792ea
Modified the Perturbator class by creating a new inheritance. Embeddi…
HugoDeBosschere Jun 8, 2026
a18fd5d
Merged attibutions/image_base.py into attributions/base.py. Changed t…
HugoDeBosschere Jun 11, 2026
23525d2
added a new class in the MultitaskExplainerMixin
HugoDeBosschere Jun 11, 2026
16693ac
Changed broken imports in Insertion Deletions. Changed the MetaClass …
HugoDeBosschere Jun 11, 2026
cb33409
small changes of import
HugoDeBosschere Jun 11, 2026
79fa067
changed Text only Granularity name from Granularity to TextGranularit…
HugoDeBosschere Jun 11, 2026
1513bff
Changed GranularityAggregationStrategy into GranularityResizeStrategy…
HugoDeBosschere Jun 12, 2026
ef6e04d
forgot an import file in the previous commit
HugoDeBosschere Jun 12, 2026
c20f25d
changed the name of the calsses in tests/model_wrapping that made the…
HugoDeBosschere Jun 12, 2026
3ed7627
fixed small bug. Perturbator is now an ABC class and as such cannot b…
HugoDeBosschere Jun 12, 2026
07437f4
merged the image specific logic into the text files but still keeping…
HugoDeBosschere Jun 12, 2026
ca2403a
changed the way the real matrix of masking values was created for the…
HugoDeBosschere Jun 15, 2026
4d317d1
Added the possibility of smooth looking explanations for attributions…
HugoDeBosschere Jun 18, 2026
5c88cca
removed 9 files that I have copied into the text files for visibility.
HugoDeBosschere Jun 18, 2026
6054271
forgot to add the image viz
HugoDeBosschere Jun 19, 2026
d945b73
the change in granularity is important to the whole previously introd…
HugoDeBosschere Jun 19, 2026
472cdd3
When generating explanations for images, we do not have the same cons…
HugoDeBosschere Jun 19, 2026
c1d6e22
this is the same commit as the previous one, I just had forgotten abo…
HugoDeBosschere Jun 19, 2026
b5a9e71
suppressed functions that are not useful anymore. Those functions (ge…
HugoDeBosschere Jun 19, 2026
38a88df
added an assert to ensure that patch_size divides the height and the …
HugoDeBosschere Jun 19, 2026
61aba1f
first try at a test file. Please give me advices on how to write a go…
HugoDeBosschere Jun 19, 2026
7b63755
changed the granularity resizing of explanations to full interpolatio…
HugoDeBosschere Jun 22, 2026
1a4aad7
added some tests for the new visualization module
HugoDeBosschere Jul 6, 2026
7e9e5f6
Added the test_image_base.py file. This file tests the ImageClassific…
Jul 8, 2026
969a7e7
Added tests for the ImageClassificationInferenceWrapper. The followin…
Jul 8, 2026
0ae5366
added files for testing and sending to a cluster to move the project …
Jul 16, 2026
62b1c41
commited all the modified files. This includes the files I needed to …
Jul 16, 2026
405233c
deleted the files that I just needed for the transfer
HugoDeBosschere Jul 16, 2026
8d1ce5c
deleted the files that I just needed for the transfer
HugoDeBosschere Jul 16, 2026
d0d8017
changed the way the vizualisation works. We used to display on the ro…
HugoDeBosschere Jul 16, 2026
e43f723
replaced _to_displayable with _denormalize. We now clamp the values t…
HugoDeBosschere Jul 16, 2026
ed88123
added some checks in the _validate_batch_feature helper func to ensur…
HugoDeBosschere Jul 17, 2026
2d97bde
changed the default behavior of the viz func so that it shows the exp…
HugoDeBosschere Jul 17, 2026
e89abac
finished writing the viz test suite. plot_image_attributions_comparis…
HugoDeBosschere Jul 17, 2026
5a6b60e
ran the pre-commit on all the interpreto/ files which I had not previ…
HugoDeBosschere Jul 17, 2026
9693e11
ran the pre-commit on all the tests/ files which I had not previously…
HugoDeBosschere Jul 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
exclude: LICENSE

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.10
rev: v0.15.22
hooks:
- id: ruff-format
- id: ruff
Expand Down
26 changes: 24 additions & 2 deletions interpreto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@

from .attributions import (
GradientShap,
ImageGradientShap,
ImageIntegratedGradients,
ImageKernelShap,
ImageLime,
ImageOcclusion,
ImageSaliency,
ImageSmoothGrad,
ImageSobol,
ImageSquareGrad,
ImageVarGrad,
IntegratedGradients,
KernelShap,
Lime,
Expand All @@ -40,7 +50,8 @@
VarGrad,
)
from .commons import (
Granularity,
ImageGranularity,
TextGranularity,
)
from .model_wrapping import ModelWithSplitPoints
from .visualizations import (
Expand All @@ -62,7 +73,18 @@ def get_version() -> str:

__all__ = [
"GradientShap",
"Granularity",
"TextGranularity",
"ImageGranularity",
"ImageGradientShap",
"ImageIntegratedGradients",
"ImageKernelShap",
"ImageLime",
"ImageOcclusion",
"ImageSaliency",
"ImageSmoothGrad",
"ImageSobol",
"ImageSquareGrad",
"ImageVarGrad",
"IntegratedGradients",
"KernelShap",
"Lime",
Expand Down
20 changes: 20 additions & 0 deletions interpreto/attributions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
from .base import InferenceModes
from .methods import (
GradientShap,
ImageGradientShap,
ImageIntegratedGradients,
ImageKernelShap,
ImageLime,
ImageOcclusion,
ImageSaliency,
ImageSmoothGrad,
ImageSobol,
ImageSquareGrad,
ImageVarGrad,
IntegratedGradients,
KernelShap,
Lime,
Expand All @@ -38,6 +48,16 @@

__all__ = [
"GradientShap",
"ImageGradientShap",
"ImageIntegratedGradients",
"ImageKernelShap",
"ImageLime",
"ImageOcclusion",
"ImageSaliency",
"ImageSmoothGrad",
"ImageSobol",
"ImageSquareGrad",
"ImageVarGrad",
"IntegratedGradients",
"KernelShap",
"Lime",
Expand Down
8 changes: 4 additions & 4 deletions interpreto/attributions/aggregations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class TorchAggregator(Aggregator):
@jaxtyped(typechecker=beartype)
def aggregate(
self,
results: Float[Tensor, "p t l"],
results: Float[Tensor, "p t l"] | Float[Tensor, "p t d l"],
mask: torch.Tensor | None = None,
) -> Float[Tensor, "t l"]:
) -> Float[Tensor, "t l"] | Float[Tensor, "t d l"]:
return self._method(results, dim=0) # type: ignore


Expand Down Expand Up @@ -170,7 +170,7 @@ class TrapezoidalMeanAggregator(Aggregator):
@jaxtyped(typechecker=beartype)
def aggregate(
self,
results: Float[Tensor, "p t l"],
results: Float[Tensor, "p t l"] | Float[Tensor, "p t d l"],
mask: torch.Tensor | None = None,
) -> Float[Tensor, "t l"]:
) -> Float[Tensor, "t l"] | Float[Tensor, "t d l"]:
return torch.trapezoid(results, dim=0) / (results.shape[0] - 1)
Loading
Loading