Difference between the descending-order and ascending-order AOPC curves. A large positive gap means the attribution method successfully ranks features by importance. ↑ better.

abpc

abpc(
    forward_func: Callable,
    inputs: TensorOrTupleOfTensorsGeneric,
    attributions: list[TensorOrTupleOfTensorsGeneric] | TensorOrTupleOfTensorsGeneric,
    baselines: BaselineType,
    feature_mask: TensorOrTupleOfTensorsGeneric = None,
    additional_forward_args: Any = None,
    target: ExplanationTarget | list[ExplanationTarget] = None,
    frozen_features: list[Tensor] | None = None,
    max_features_processed_per_batch: int | None = None,
    total_feature_bins: int = 100,
    n_random_perms: int = 10,
    seed: int | None = None,
    multi_target: bool = False,
    show_progress: bool = True,
) -> Tensor | list[Tensor]

Area Between Perturbation Curves (ABPC) — descending AOPC minus ascending AOPC. ↑ better.

A larger gap between the descending and ascending perturbation curves indicates that the attribution method correctly ranks feature importance. Wraps aopc and returns desc_aopc - asc_aopc.

See aopc for full argument documentation.

Source code in torchxai/metrics/faithfulness/aopc.py
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
def abpc(
    forward_func: Callable,
    inputs: TensorOrTupleOfTensorsGeneric,
    attributions: "list[TensorOrTupleOfTensorsGeneric] | TensorOrTupleOfTensorsGeneric",
    baselines: "BaselineType",
    feature_mask: "TensorOrTupleOfTensorsGeneric" = None,
    additional_forward_args: Any = None,
    target: "ExplanationTarget | list[ExplanationTarget]" = None,
    frozen_features: "list[torch.Tensor] | None" = None,
    max_features_processed_per_batch: "int | None" = None,
    total_feature_bins: int = 100,
    n_random_perms: int = 10,
    seed: "int | None" = None,
    multi_target: bool = False,
    show_progress: bool = True,
) -> "Tensor | list[Tensor]":
    """Area Between Perturbation Curves (ABPC) — descending AOPC minus ascending AOPC. ↑ better.

    A larger gap between the descending and ascending perturbation curves indicates that the
    attribution method correctly ranks feature importance. Wraps `aopc` and returns
    ``desc_aopc - asc_aopc``.

    See `aopc` for full argument documentation.
    """
    _target = target if target is not None else NoTarget()
    desc, asc, *_ = aopc(
        forward_func=forward_func,
        inputs=inputs,
        attributions=attributions,
        baselines=baselines,
        feature_mask=feature_mask,
        additional_forward_args=additional_forward_args,
        target=_target,
        frozen_features=frozen_features,
        max_features_processed_per_batch=max_features_processed_per_batch,
        total_feature_bins=total_feature_bins,
        n_random_perms=n_random_perms,
        seed=seed,
        multi_target=multi_target,
        show_progress=show_progress,
        return_intermediate_results=False,
        return_dict=False,
    )
    if multi_target:
        return [d - a for d, a in zip(desc, asc, strict=False)]
    return desc - asc