Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If you want to contribute/ improve/ extend Quantus, join our [Discord](https://d

- 🐼 For **training data attribution** evaluation, check out [quanda](https://github.com/dilyabareeva/quanda)!
- New [batch implementation](https://github.com/understandable-machine-intelligence-lab/Quantus/pull/351) for 12X speedup of existing faithfulness metrics (!)
- New metrics added: [EfficientMPRT](https://github.com/understandable-machine-intelligence-lab/Quantus/blob/main/quantus/metrics/randomisation/efficient_mprt.py) and [SmoothMPRT](https://github.com/understandable-machine-intelligence-lab/Quantus/blob/main/quantus/metrics/randomisation/smooth_mprt.py) by [Hedström et al., (2023)](https://openreview.net/pdf?id=vVpefYmnsG)
- New metric added: [Generalised Explanation Faithfulness (GEF)](https://github.com/understandable-machine-intelligence-lab/Quantus/blob/main/quantus/metrics/unified/generalised_explanation_faithfulness.py) by [Hedström et al., (2025]https://openreview.net/pdf?id=ukLxqA8zXj)
- Accepted to Journal of Machine Learning Research (MLOSS), read the [paper](https://jmlr.org/papers/v24/22-0142.html)
- Offers more than **35+ metrics in 6 categories** for XAI evaluation
- Supports different data types (image, time-series, tabular, NLP next up!) and models (PyTorch, TensorFlow)
Expand Down
3 changes: 3 additions & 0 deletions quantus/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
"NonSensitivity": NonSensitivity,
"InputInvariance": InputInvariance,
},
"Unified": {
"Generalised Explanation Faithfulness": GeneralisedExplanationFaithfulness
}
}


Expand Down
1 change: 1 addition & 0 deletions quantus/helpers/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ class EvaluationCategory(Enum):
COMPLEXITY = "Complexity"
LOCALISATION = "Localisation"
AXIOMATIC = "Axiomatic"
UNIFIED = "Unified"
NONE = "None"
1 change: 1 addition & 0 deletions quantus/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
from quantus.metrics.localisation import *
from quantus.metrics.randomisation import *
from quantus.metrics.robustness import *
from quantus.metrics.unified import *
Empty file.
58 changes: 58 additions & 0 deletions quantus/metrics/unified/generalised_explanation_faithfulness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""This module contains the implementation of the Completeness metric."""

# This file is part of Quantus.
# Quantus is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# Quantus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License along with Quantus. If not, see <https://www.gnu.org/licenses/>.
# Quantus project URL: <https://github.com/understandable-machine-intelligence-lab/Quantus>.

import sys
from typing import Any, Callable, Dict, List, Optional

import numpy as np

from quantus.functions.perturb_func import baseline_replacement_by_indices
from quantus.helpers import warn
from quantus.helpers.enums import (
DataType,
EvaluationCategory,
ModelType,
ScoreDirection,
)
from quantus.helpers.model.model_interface import ModelInterface
from quantus.helpers.perturbation_utils import make_perturb_func
from quantus.metrics.base import Metric
from quantus.helpers.utils import identity

if sys.version_info >= (3, 8):
from typing import final
else:
from typing_extensions import final


@final
class GeneralisedExplanationFaithfulness(Metric[List[float]]):
"""
Implementation of Generalised Explanation Faithfulness test by Hedström et al., 2025.

Insert desription

References:
1) Hedström et al., "Evaluating Interpretable Methods via Geometric Alignment of Functional Distortions"
Transactions of Machine Learning Research, 2025.

Attributes:
- _name: The name of the metric.
- _data_applicability: The data types that the metric implementation currently supports.
- _models: The model types that this metric can work with.
- score_direction: How to interpret the scores, whether higher/ lower values are considered better.
"""

name = "GEF"
data_applicability = {DataType.IMAGE, DataType.TIMESERIES, DataType.TABULAR}
model_applicability = {ModelType.TORCH}
score_direction = ScoreDirection.HIGHER
evaluation_category = EvaluationCategory.UNIFIED

def __init__()
pass
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ commands =

[testenv:build]
description = Build environment
base_python = py310
base_python = python3.10
deps =
.
build
twine
commands =
python3 -m build .
python3 -m twine check ./dist/* --strict
python3.10 -m build .
python3.10 -m twine check ./dist/* --strict

[testenv:lint]
description = Check the code style
Expand Down