Concept Activation Regions: A Generalized Framework For Concept-Based Explanations
Abstract
Concept-based explanations permit to understand the predictions of a deep neural network (DNN) through the lens of concepts specified by users.
Existing methods assume that the examples illustrating a concept are mapped in a fixed direction of the DNN’s latent space.
When this holds true, the concept can be represented by a concept activation vector (CAV) pointing in that direction.
In this work, we propose to relax this assumption by allowing concept examples to be scattered across different clusters in the DNN’s latent space.
Each concept is then represented by a region of the DNN’s latent space that includes these clusters and that we call concept activation region (CAR).
To formalize this idea, we introduce an extension of the CAV formalism that is based on the kernel trick and support vector classifiers.
This CAR formalism yields global concept-based explanations and local conceptbased feature importance.
We prove that CAR explanations built with radial kernels are invariant under latent space isometries.
In this way, CAR assigns the same explanations to latent spaces that have the same geometry.
We further demonstrate empirically that CARs offer (1) more accurate descriptions of how concepts are scattered in the DNN’s latent space; (2) global explanations that are closer to human concept annotations and (3) concept-based feature importance that meaningfully relate concepts with each other.
Finally, we use CARs to show that DNNs can autonomously rediscover known scientific concepts, such as the prostate cancer grading system.
Introduction
Deep learning models are both useful and challenging.
Their utility is reflected in their increasing contributions to sophisticated tasks such as natural language processing [1, 2], computer vision [3, 4] and scientific discovery [5–8].
Their challenging nature can be attributed to their inherent complexity.
State of the art deep models typically contain millions to billions parameters and, hence, appear as black-boxes to human users.
The opacity of black-box models make it difficult to: anticipate how models will perform at deployment [9]; reliably distil knowledge from the models [10] and earn the trust of stakeholders in high-stakes domains [11–13].
With the aim of increasing the transparency of black-box models, the field of explainable AI (XAI) developed [14–17].
We can broadly divide XAI methods in 2 categories: 1 Methods that restrict the model’s architecture to enable explanations.
Examples include attention models that motivate their predictions by highlighting features they pay attention to [18] and prototype-based models that motivate their predictions by highlighting relevant examples from their training set [19].
2 Post-hoc methods that can be used in a plug-in fashion to provide explanation for a pre-trained model.
Examples include feature importance methods (also known as feature attribution or saliency methods) that highlight features the model is sensitive to [20– 26]; example importance methods that identify influential training examples [27–29] and hybrid 36th Conference on Neural Information Processing Systems (NeurIPS 2022).
methods combining the two previous approaches [30].
In this work, we focus on a different type of explanation methods known as concept-based explanations.
Let us now summarize the relevant literature to contextualize our own contribution.
Related work.
Concept-based explanations were first formalized with the concept activation vector (CAV) formalism [31, 32].
Given a concept specified by the user (e.g. stripes in an image), linear classifiers are used as probes [33] to assess whether a deep model’s representation space separates examples where a concept is present ( concept positive examples ) from examples where a concept is absent ( concept negative examples ).
A CAV is then extracted from the linear classifier’s weights.
With this CAV, it is possible to provide post-hoc explanations such as the sensitivity of a model’s prediction to the presence/absence of a concept.
It goes without saying that several concepts are needed to explain the prediction of a deep model.
To formalize this idea, existing works have used concept basis decomposition [34] and sufficient statistics [35].
Although most applications of CAV involve image data, we note that the formalism has been successfully applied to time-series data [36, 37].
While concepts are typically specified by the user, early works in computer vision have been undertaken to discover concepts in the form of meaningful image segmentations [38].
The main criticism against the CAV formalism is that it requires concept positive examples to be linearly separable from concept negative examples [39, 40].
This is because linear separability of concept sets is a restrictive criterion that the model is not explicitly trained to fulfil.
To address this issue, works like concept whitening transformations [39] and concept bottleneck models [41–43] propose to do away with the post-hoc nature of concept-based explanations.
These methods introduce new neural network architectures that permit to train the models with concept labels.
We stress that this requires the set of concepts to be specified before training the model.
This assumes that we know what concepts are relevant for a model to solve a downstream task a-priori .
This is not the case whenever we train a model to solve a task for which little or no knowledge is available.
In this setup, it seems more appropriate to train a model for the task first and, then, perform a post-hoc analysis of the model to determine the concepts that were relevant in providing a solution.
Furthermore, recent concerns have emerged regarding the reliability of interpretations provided by these altered model architectures [44, 45].
Contributions.
In this work, our purpose is to retain the flexible post-hoc nature of concept-based explanations without assuming that the concept sets are linearly separable.
To that aim, we introduce concept activation regions (CARs), an extension of the CAV framework illustrated in Figure 1.
1 Generalized formalism.
As a substitute to linear separability, we propose in Section 2.1 to adapt the smoothness assumption from semi-supervised learning [46].
Intuitively, this more general assumption only requires positive and negative examples to be scattered across distinct clusters in the model’s representation space.
In practice, this generalization is implemented by substituting CAV’s linear classifiers by kernel-based support vector classifiers.
We demonstrate that choosing radial kernels leads to CAR classifiers that are invariant under isometries of the latent space.
This permits to assign identical explanations to latent spaces characterized by the same geometry.
Moreover, we show in Section 3.1.1 that our CAR classifiers yield a substantially more accurate description of how concepts are distributed in deep model’s representation spaces.
2 Better global explanations.
With the nonlinear decision boundaries of our support vector classifiers, there is no obvious way to adapt the notion of concept activation vectors.
Since CAV’s concept importance (TCAV score) is computed with these vectors, we need an alternative approach.
In Section 2.2, we propose to define concept importance by building on our smoothness assumption.
Concretely, a concept is important for a given example if the model’s representation for this example lies in a cluster of concept positive representations.
With this characterization, we define TCAR scores that are the CAR equivalent of TCAV scores.
In Section 3.1.2, we demonstrate that TCAR scores lead to global explanations that are more consistent with concept annotations provided by humans.
3 Concept-based feature importance.
In Section 2.3, we argue that our CAR formalism permits to assign concept-specific feature importance scores for each example fed to the neural network.
We verify empirically in
Section 3.1.3 that those feature importance scores reflect meaningful concept associations.
Finally, we illustrate in Section 3.2 how these contributions permit to establish that deep models implicitly discover known scientific concepts.
Concept Activation Regions (CARs) 2.1 Preliminaries
We assume a typical supervised setting where each sample is represented by a couple ( x , y ) with input features x ∈ X ⊆
R
d
X and
a label y ∈ Y ⊆
R d Y , where d X , d Y ∈ N ∗ are respectively the dimensions of the feature (or input) and label (or output) spaces 1 .
In order to predict the labels from the features, we are given a deep neural network (DNN) f
= l ◦ g : X → Y , where g : X
→ H is a feature extractor that maps features x ∈ X to latent representations
h = g ( x ) ∈ H ⊆
R d H and l : H → Y maps latent representations h ∈ H to labels y
= l ( h ) ∈ Y .
The representation h
= g ( x ) typically corresponds to the output from one of the DNN’s hidden layer.
We assume that the model f was obtained by fitting a training set D train ⊂ X × Y .
Our purpose is to understand how the neural network representation induced by g allows the model f to solve the prediction task.
To that end, we shall use concept-based explanations.
Those explanations rely on a set of C ∈ N ∗ concepts indexedby c ∈
[ C ] , where [ C ] denotes the set of positive integers between 1 and C .
Each concept c ∈ [ C ] is defined by the user through a set of N c ∈ N ∗ positive examples P c
= { x c,n | n ∈ [ N c ] } and a set of
N ¬ c negative examples N
c
= { x ¬ c,n | n ∈ [ N ¬ c ] } .
The concept c ∈ [ C ] is present in the positive examples P c and absent from the negative examples N c .
For instance, if we work in a computer vision context and the concept of interest is c =
Stripes, then P c contains images with stripes (e.g. zebra images) and N c contains images without stripes (e.g. cow images).
We note that non-binary concepts (e.g. a colour) can be one-hot encoded to fit this formulation.
In this paper, we use balanced sets: N c = N ¬ c .
CAV formalism.
Let us start by summarizing the CAV formalism [31].
This formalism relies on the crucial assumption that the sets g ( P c ) ⊂
H and g ( N c ) ⊂
H are linearly separable in H .
Hence, it is possible to find a vector w c ∈ R d H and a bias term b c ∈ R such that ( w c ) ⊺
h + b c > 0 for all h ∈ g
( P c ) and, conversely, ( w c ) ⊺
h + b c < 0 for all h ∈ g ( N c ) .
The vector w c is called the concept activation vector (abbreviated CAV) associated to the concept c ∈ [ C ] .
Geometrically, this vector is normal to the hyperplane separating g
( P c ) from g ( N c ) in the latent space H .
Intuitively, this vector points in a direction of the latent space where the presence of the concept c ∈ [ C ] increases.
When f k ( x ) = l k ◦ g
( x ) corresponds to the predicted probability of class k ∈ [ d Y ] for x ∈ X , this insight allows us to define a class-wise conceptual sensitivity.
Indeed, the directional derivative
S ck ( x ) ≡ ( w c ) ⊺ ∇ h l k
[ g ( x )] measures the extent to which the probability of class k varies in the direction of the CAV.
If the sensitivity is positive S ck ( x ) > 0 , this indicates that the presence of concept c increases the belief of the model f that k is the correct class for example x .
Note that
CAV sensitivities
S ck
( x ) can be generalized to aggregate the gradients between g ( x ) and a baseline ¯ h ∈ H [32].
Given a dataset of examples split by class D = (cid:70)
d Y k
=1 D k , where D k contains only examples of class k ∈ [ d Y ] , it is possible to summarize the overall sensitivity of class k to concept c by computing the score
TCAV ck
= |{ x ∈D k
| S ck ( x ) > 0 }| / |D| , where |·| denotes the set cardinality.
The limitations of linear separability.
The linear separability of concept negatives and positives is central in the aforementioned formalism.
Indeed, the existence of a separating hyperplane in H is necessary to define CAVs, which in turn are required to define concept sensitivity and TCAV scores.
This assumption has been criticized in the literature [39, 40].
The main criticism is the following: there is no reason to expect the representation map g to linearly separate concept positive and negatives since these concept-related labels are not known by the model.
Let us consider a concrete example to stress that generic classifiers should not be expected to linearly separate concepts even if they linearly separate classes.
Consider a classifier f = l ◦ g , where for each class k ∈
[ d Y ] : l k ( h ) =
Softmax( α ⊺ k h + β k ) with α k ∈ R d H and β k ∈ R .
This parametrization is typically realized when the representation space
H corresponds to the penultimate layer of a neural network.
For concreteness, we consider a computer vision setting with the classes k ∈ { Tiger , Lion , Cow , Zebra } .
We note that the decision boundary in H for any pair of class is a hyperplane.
For instance, the decision boundary between the classes lion and tiger is parametrized by l Lion ( h ) =
l Tiger ( h ) , which corresponds to the equation of a hyperplane in H : ( α Lion − α Tiger ) ⊺ h
+ ( β Lion − β Tiger )
= 0 .
In this setting, any successful classifier f requires a representation map g that linearly separates the classes in the latent space H .
We now consider the concept c = Stripes.
In this case, we can expect examples from the classes tiger and zebra in P Stripes (as both tigers and zebras have stripes) and examples from the classes lion and cow in
N Stripes (as neither lions nor cows have stripes).
As illustrated in Figure 2, it is therefore perfectly possible to have g ( P Stripes ) and g ( N Stripes ) that are not linearly separable in spite of the classes linear separability.
With this example, we emphasize the subtle distinction between classes and concept linear separability.
While the former is expected and holds experimentally [33], this is not the case for the latter.
A better assumption.
Although the representations from Figure 2 do not linearly separate the concept sets, we note that concept positive and negative examples are scattered across distinct clusters.
In this way, a model that produces these representations appears to make a difference between presence and absence of the concept.
From this angle, we could consider that the concept is well encoded in the representation space geometry.
To formalize this more general notion of concept set separability, we adapt the smoothness assumption originally formulated in semi-supervised learning [46].
Assumption 2.1 (Concept Smoothness) .
A concept c ∈ [ C ] is encoded in the latent space H if
H is smooth with respect to the concept.
This means that we can separate H
= H c (cid:70) H ¬ c into a concept activation region (CAR)
H c where the concept c is mostly present (i.e. | g
( P c ) (cid:84)
H c | ≫ | g ( N c ) (cid:84)
H c | ) and a region H ¬ c where the concept c is mostly absent (i.e. | g ( N c ) (cid:84)
H ¬ c | ≫ | g
( P c ) (cid:84) H ¬ c | ).
If two points h 1 , h 2 ∈ H in a high-density region of the latent space are close to each other, then we should have h 1 , h 2 ∈ H c or h 1 , h 2 ∈ H ¬ c .
Remark 2.1 .
We can easily see that linear separability is trivially included in this assumption: it corresponds to the case where the CAR H c and H ¬ c are separated by a hyperplane.
Conversely, our assumption does not require the CAR H c and H ¬ c to be separated by a hyperplane for a concept to be relevant, as illustrated in Figure 3.
There are two crucial components in the previous assumption that need to be detailed: what do we mean by density and how do we extract a CAR H c from H .
2.2 Detecting Concepts
Concept Density.
Let us start by detailing the notion of density that we use.
We first note that the notion of proximity in H is crucial in Assumption 2.1.
It is conventionally formalized through a kernel function κ : H 2 → R + [47].
These functions are such that the proximity between h 1 , h 2 ∈ H increases with κ ( h 1 , h 2 ) .
Similarly, the proximity between h and a discrete set S ⊂ H of representations increases with (cid:80) h
′ ∈S κ ( h , h ′ ) .
This last sum can be interpreted as the density of examples from S at a point h ∈ H .
In our setup, it is natural to define a density relative to each concept c ∈
[ C ] by using the two sets P c and N c .
This motivates the following definition.
Definition 2.1 (Concept Density) .
Let κ : H 2 → R + be a kernel function.
For each concept c ∈ [ C ] , we assume that we have a positive set P c
= { x c,n | n ∈ [ N c ] } and a negative set N c = { x ¬ c,n | n ∈ [ N c ] } .
We define the concept density as a function ρ c : H → R such that
[Equation]
The concept density for an example x ∈ X can similarly be defined as ρ c [ g ( x )] .
Remark 2.2 .
This density function is not necessarily positive.
Indeed, we have assigned a positive contribution for examples from P c and a negative one for those of N c .
The idea is that ρ c ( h ) >whenever the density of g ( P c ) is higher around h .
Conversely, ρ c ( h ) < 0 whenever the density of g ( N c ) is higher around h .
Finally, ρ c ( h ) ≈
if h is isolated from positive and negative examples or if the density of g ( P c ) balances the density of g ( N c ) around h .
Concept Activation Regions.
With this definition, it is tempting to use the density ρ c to define the regions H c and H ¬ c .
A natural choice would be to define the CAR as the positive density region
H c = ( ρ c ) − 1 ( R + ) and its complementary as the negative density region H ¬ c
=
( ρ c ) − 1 ( R − ) .
This corresponds to using a Parzen window classifier for the concept [48].
An obvious limitation of this approach is that each evaluation of the density ρ c scales linearly with the number N c of concept examples.
If the size of concept sets is large, it is possible to obtain a sparse version of this Parzen window classifier with a support vector classifier (SVC) [49, 50] s cκ : H → { 0 , 1 } .
This SVC is fitted to discriminate the concept sets g ( P c ) and g ( N c ) .
We can then define the CARs as H c = ( s cκ ) − 1 (1) and H ¬ c = ( s cκ ) − 1 (0) .
More details can be found in Appendix A.
Global explanations.
Our CAR formalism permits to extend those local (i.e. sample-wise) considerations globally.
Let us start by defining the equivalent of TCAV scores described in Section 2.1.
This score aims at understanding how the model relates classes with concepts.
We define the TCAR score as the fraction of examples that have class k and whose representation lies in the CAR H c :
TCAR ck
= | g
( D k ) (cid:84)
H c | / |D k | .
Note that TCAR ck ∈ [0 , 1] , where 0 corresponds to no overlap and 1 to a full overlap.
In Appendix B, we extend this approach to measure the overlap between two concepts.
Latent space isometries invariance.
In many applications such as clustering [51] or data visualization [52], the only relevant geometrical information of the representation space H is the distance ∥ h 1 − h
∥
H between every pair of points ( h 1 , h 2 ) ∈ H 2 .
Informally, we say that two representation spaces are isometric if they assign the same distance to each pair of points.
In the aforementioned applications, two isometric representation spaces are therefore indistinguishable from one another.
Since concept-based explanations similarly describe the representation space geometry, one might require similar invariance to hold in this context.
In Appendix D, we show that our CAR formalism provides such guarantee if κ is a radial kernel [53].
To the best of our knowledge, this type of analysis has not been performed in the context of concept-based explanation methods.
We believe that future works in this domain would greatly benefit from this type of insight.
2.3 Concepts and Features
Not all features are relevant to identify a concept.
As an example, let us consider the concept c =
Stripes in a computer vision setting.
If the image x represents a zebra, only some small portion of the image will exhibit stripes (namely the body of the zebra).
Therefore, if we build a saliency map for the concept c , we expect only this part of the image to be relevant for the identification of this concept.
Existing works to produce concept-level saliency maps relying on the CAV formalism exist in the literature [34, 54].
In the absence of CAVs, we need an alternative approach.
We now describe how any feature importance method can be used in conjunction with CARs.
A generic feature importance method assigns a score a i ( f, x ) ∈ R to each feature
i ∈
[ d X ] for a scalar model f : X → R to make a prediction f ( x ) [55].
Since our purpose is to measure the relevance of each feature in identifying a concept c ∈
[ C ] , we compute the feature importance for the concept density: a i ( ρ c ◦ g , x ) .
Note that some specific feature importance methods, such as Integrated Gradients [25] or Gradient Shap [24], require the explained model to be differentiable.
This is the case whenever the kernel κ and the latent representation g are differentiable.
We note that the support vector classifier s cκ cannot be used in this context due to its non-differentiability.
In Appendix C, we show that
our
CAR-based feature importance can be endowed with a useful completeness propriety that relates the importance scores a i ( ρ c ◦ g , x ) to the concept density ρ c ◦ g ( x ) .
Experiments
The code to reproduce all the experiments from this section is available at https://github.com/
JonathanCrabbe/CARs and https://github.com/vanderschaarlab/CARs .
3.1 Empirical Evaluation
Our purpose is to empirically validate the formalism described in the previous section.
We have several independent components to evaluate: 1 the concept classifier used to detect the CARs H c , 2 the global explanations induced by the TCAR values and 3 the feature importance scores induced by the concept densities ρ c .
Datasets.
We perform our experiments on 3 datasets.
1 The MNIST dataset [56] consists of 28 ×grayscale images, each representing a digit.
We train a convolutional neural network (CNN) withlayers to identify the digit of each image.
The MIT-BIH Electrocardiogram (ECG) dataset [57, 58] consists of univariate time series with 187 time steps, each representing a heartbeat cycle.
We train a
CNN with 3 layers to determine whether each heartbeat is normal or abnormal.
The Caltech-UCSD
Birds-200 (CUB) dataset [59] consists of coloured images of various sizes, each representing a bird from one of the 200 species present in the dataset.
We fine-tune an Inceptionv3 neural network [60] to identify the species each bird belongs to among the 200 possible choices.
Concepts.
For each dataset, we study the models through the lens of several well-defined concepts that are provided by human annotations.
For MNIST: we use C = 4 concepts that correspond to simple geometrical attributes of the images: Loop (positive images include a loop), Vertical/Horizontal Line (positive images include a vertical/horizontal line) and Curvature (positive images contain segments that are not straight lines).
For ECG: we use C = 4 concepts defined by cardiologists to better characterize abnormal heartbeats [61]: Premature Ventricular , Supraventricular , Fusion Beats and
Unknown .
The exact definition for each of these concepts is beyond the scope of this paper.
We simply note that annotations for those concepts are available in the ECG dataset.
3 For CUB
: we use C = 112 concepts that correspond to visual attributes of the birds (e.g. their size, the colour of their wings, etc.).
We use the same procedure as [41] to extract those concepts from the CUB dataset.
We stress that, in each case, we selected concepts that can be unambiguously associated to the classes that are predicted by the models.
Hence, it is reasonable to expect those concepts to be salient for the
Conv Conv
Lin
Lin2 Layer 0.
O v e r a ll C o n c e p t
A cc u r a c y
Method CARCAV (a) MNIST
Conv Conv
Conv
Lin Layer 0.
O v e r a ll C o n c e p t
A cc u r a c y
[Figure]
CARCAV (
[Figure]
) ECG
[Figure] [Figure]
O v e r a ll C o n c e p t
A cc u r a c y
[Figure]
CARCAV (c) CUB models.
In each case, we sample the positive and negative sets P c and N c from the model’s training sets.
For more details on the concepts and the models, please refer to Appendix E.
3.1.1 Accuracy of concept activation regions
Methodology.
The purpose of this experiment is to assess if the concept regions H c identified by our CAR classifier generalize well to unseen examples.
Each of the models described above are endowed with several representation spaces (one per hidden layer).
For several of those latent spaces, we fit our CAR classifier (SVC with radial basis function kernel) to discriminate the concept sets
P c , N c for each concept c ∈
[ C ] .
These two sets have a size N c = 200 and are sampled from the model’s training set.
The classifier is then evaluated by computing its accuracy on a holdout balanced concept set T c of size 100 sampled from the model’s testing set.
For MNIST and ECG, we repeat this experiment 10 times for each concept and let the sets P c , N c , T c vary on each run.
For comparison, we perform the same experiment with a linear CAV classifier as a benchmark.
We report the overall (all the concepts together) accuracy in Figure 4.
Analysis.
The CAR classifier substantially outperforms the CAV classifier.
Note that this advantage is even more striking in the representation spaces associated to the deeper (last) DNN layers.
This can be better understood through the lens of Cover’s theorem [62]: the linear separation underlying
CAV is usually easier to achieve in higher dimensional spaces, which corresponds to the shallower (first) DNN layers in this case.
When the dimension d H of the latent space becomes comparable to the size N c of the concept sets, linear separation often fails to maintain a high accuracy.
By contrast, the SVC underlying CARs manage to maintain high accuracy through the more flexible notion of concept smoothness defined in Assumption 2.1.
This suggests that concepts can be well encoded in the geometry of the latent space even when accurate linear separability is not possible.
We also note that the accuracy CAR classifiers seems to increase with the representation’s depth.
This is consistent with the behaviour of class probes [33].
Statistical significance.
The statistical significance of the concept classifiers is evaluated with the permutation test from [32].
All of them are statistically significant with p-value < .
except for some concepts classifiers that are fitted with the layers Mixed5d and Mixed6e of the CUB Inceptionv model.
We note that those classifiers do not generalize well in Figure 4c.
This suggests that deeper networks are required to identify more challenging concepts correctly.
Take-away 1: CAR classifiers better capture how concepts are spread across representation spaces.
3.1.2 Consistency of global explanations
Methodology.
The purpose of this experiment is to assess if the aforementioned concept classifiers create meaningful global association between classes and concepts.
For each model, we now focus our study on the penultimate layer.
We compute the TCAV and TCAR scores for each (class , concept) pair over the whole testing set.
Ideally, these scores should be correlated to the true proportion (computed with the human concept annotations) of examples from the class that exhibit the concept.
To that aim, we report the Pearson correlation r between each score and this true proportion in Table 1.
To illustrate those global explanations, we also provide the scores for one class of each dataset in
Figure 5 (for CUB, we restrict to wing colour concepts, other examples are reported in Appendix K).
[Figure] [Figure]
BreastColorBlack BreastColorWhite
Vanilla -0.
C o rr e l a t i o n (c) CUB
[Table]
Analysis.
The TCAR scores better correlate with the true presence of concepts.
This difference can be understood by looking at the examples from Figure 5.
We note that TCAV scores tend to predict nonexistent associations (e.g. yellow wings for American crows) and miss existing associations (e.g. curvature for digit 2).
For
ECG, we note that TCAR does capture the fact that some concepts (like fusion beats) are less represented within the class, while TCAV does not.
In all of these cases, TCAV explanations might give the impression that the model did not learn meaningful class-concept associations.
The TCAR analysis leads to the opposite conclusion.
Since we have established that TCAR is built upon more accurate concept classifiers, it seems that models indeed learn concepts as intended, in spite of what
TCAV explanations suggest.
Take-away 2: TCAR scores more faithfully reflect the true association between classes and concepts.
3.1.3 Coherency of concept-based feature importance
Methodology.
Focusing again on the model’s penultimate layer, we are now interested in feature importance.
The evaluation of feature importance methods is a notoriously difficult problem [63].
To perform an analysis in line with our concept-based explanations, we propose to check that our concept-based feature importance meaningfully captures features that are concept-specific.
We analyse this through 2 desiderata: 1 concept-based feature importance is not equivalent to the model (vanilla) feature importance and 2 only concepts that can be identified with similar features should yield correlated feature importance.
To evaluate these desiderata empirically, we compute our CAR-based Integrated Gradients a i ( ρ c ◦ g , x ) for each concept c ∈ [ C ] and for each example x ∈ D test from the test set.
Similarly, we compute the vanilla Integrated Gradients
a i ( f , x ) for the model 3 .
We quantitatively compare these various feature importance scores by computing their
Pearson correlation r as in [64, 65].
We report the results in Figure 6 (again, we selected a subset of 6 concepts for CUB).
Analysis.
First, we observe that CAR-based feature importance correlates weakly with vanilla feature importance ( | r | < .
25 for all datasets).
This confirms that desideratum 1 is fulfilled.
Then, we note that most of the CAR-based feature importance scores are decorrelated or weakly correlated with each other.
The counterexamples that we observe indeed correspond to concepts that can be identified with similar features.
A first example is the positive correlation between the loop and the curvature concepts for MNIST ( r = . 71 ), both concepts are generally associated to curved symbols.
Another example is the negative correlation between striped and solid back patterns for CUB birds ( r = − . 86 ), those concepts are mutually exclusive and identified by inspecting the bird’s back.
Those examples support that CAR-based feature importance fulfils desideratum 2 .
Take-away 3: CAR-based feature importance is concept-specific and captures concept associations.
3.2 Use Case: Machine Learning Model Rediscovering Known Medical Concepts
We will now describe a use case of the CAR formalism introduced in this paper.
We stress that the literature already contains numerous use cases of CAV concept-based explanations, especially in the medical setting [66, 67, 37].
Since CARs generalize CAVs, it goes without saying that they apply to these use cases.
Rather than repeating existing usage of concept-based explanations, we discuss an alternative use case motivated by recent trends in machine learning.
With the successes of deep models in various scientific domains [5–8], we witness an increasing overlap between scientific discovery and machine learning.
While this new trend opens up fascinating opportunities, it comes with a set of new challenges.
The evaluation of machine learning models is arguably one of the most important of these challenges.
In a scientific context, the canonical machine learning approach to validate models (out-of-sample generalization) is likely to be insufficient.
Beyond generalization on unseen data, the scientific validity of a model requires consistency with established scientific knowledge [68].
We propose to illustrate how our CARs can be used in this context.
Dataset.
We use the data collected with the Surveillance, Epidemiology, and End Results (SEER)
Program.
The dataset [69] contains a US population-based cohort of 171,942 men diagnosed with non-metastatic prostate cancer between Jan 1, 2000, and Dec 31, 2016.
Each patient is described by age, the results of a prostate-specific antigen blood test (PSA), the clinical stage of its tumour and two Gleason scores (primary and secondary).
Each patient also has a label that indicates if they died because of their prostate cancer.
We train a multilayer perceptron (MLP) to predict the patient’s mortality on 90% of the data and test on the remaining 10% .
For a more detailed description of the data and the model, please refer to Appendix F.
Concepts.
Doctors use an established grading system to predict how likely the cancer is to spread [70].
This system assigns to each patient a grade between 1 and 5.
The probability that the cancer spreads increases with this grade.
It can be computed from the two Gleason scores (more details in
Appendix F).
We can consider each of these 5 grades as a concept.
We note that this grade is not explicitly part of the input features of the MLP that we trained.
Our purpose is to assess if the MLP implicitly discovered those grades in order to predict the patient’s mortality.
If this happens to be the case, this would demonstrate that the MLP is in-line with existing medical knowledge.
Methodology.
As in the previous section, we are going to use the output of the MLP’s penultimate layer as a representation space.
We fit a CAR classifier (SVC with linear kernel) to discriminate the concepts sets P c , N c for each grade c ∈ [5] .
Both of those sets contain N c = 250 patients sampled from the training set.
We then proceed to several verifications.
1 We determine if the grades have been learned by measuring the accuracy of each CAR classifier on a holdout balanced concept set
T c of size 100 sampled from the model’s testing set.
2 We check that each grade is associated to the appropriate outcome by reporting the TCAR scores between each pair (mortality , grade) in
Figure 7a.
3 We verify that grades are identified with the right features by plotting a summary of the absolute feature importance scores | a i ( ρ c ◦ g , x ) | on the test set x ∈ D test in Figure 7b.
Analysis.
Let us summarize the findings for each of the above points.
1 All of the CAR classifiers generalize well on the test set (their accuracy ranges from 90% to 100% ).
This strongly suggests that the MLP implicitly separates patients with different grades in representation space.
2 Figure 7a demonstrates that the model associates higher grades with higher mortality.
This is in line with the clinical interpretation of the grades.
3 Figure 7b suggests that the Gleason scores constitute the most important features overall (highest quantiles) for the model to discriminate between grades.
This is consistent with the fact that grades are computed with the Gleason scores.
We conclude that the MLP
[Figure]
GleasonScores
[Figure] [Figure]
[Figure] [Figure]
[Figure]
A b s o l u t e I m p o r t a n c e
[Figure]
implicitly identifies the patient’s grades with high accuracy and in a way that is consistent with the medical literature.
Take-away 4: The CAR formalism can reliably support scientific evaluation of a model.
Conclusion
We introduced Concept Activation Regions, a new framework to relax the linear separability assumption underlying the Concept Activation Vector formalism.
We showed that our framework guarantees crucial properties, such as invariance with respect to latent symmetries.
Through extensive validation on several datasets, we verified that 1 Concept Activation Regions better capture the distribution of concepts across the model’s representation space,
The resulting global explanations are more consistent with human annotations and 3 Concept Activation Regions permit to define concept-specific feature importance that is consistent with human intuition.
Finally, through a use case involving prostate cancer data, we show the neural network can implicitly rediscover known scientific concepts, such as the prostate cancer grading system.
Many important points that were not covered in the main paper can be found in the appendices.
In Appendix A, we discuss how to tune the various hyperparameters of the CAR classifiers.
In
Appendix B, we explain how to generalize concept activation vectors to nonlinear decision boundaries.
In Appendix G, we show that the CAR explanations are robust to adversarial perturbations and background shifts.
In Appendix H, we demonstrate that CAR explanations can be used to relate abstract concepts discovered by self-explaining neural networks with human concepts.
Finally,
Appendix I illustrates how CAR explanations allow us to probe language models.
We believe that our extended concept explainability framework opens up many interesting avenues for future work.
A first one would be to probe state of the art neural networks with an approach similar to Section 3.
In particular, it would be interesting to analyse if improving model performance is associated with a better encoding of human concepts.
A second one would be to analyze how concept discovery [38] can benefit from our generalized notion of concept activation.
A more fine-grained characterization of a model’s latent space is likely to improve the surfaced concept.
A third one, as suggested by Section 3.2, would be to use concept-based explanations to make a better scientific assessment of neural networks.
Indeed, consistency with well-established knowledge is crucial for a scientific model to be accepted.
Acknowledgments and Disclosure of Funding
The authors are grateful to Fergus Imrie, Yangming Li and the 3 anonymous NeurIPS reviewers for their useful comments on an earlier version of the manuscript.
Jonathan Crabbé is funded by Aviva and Mihaela van der Schaar by the Office of Naval Research (ONR), NSF 172251.
A CAR Classifiers
In this appendix, we provide some details about our CAR classifiers.
Implementation.
To determine the concept activation regions, we fit a SVC s cκ for each concept c ∈ [ C ] .
This process is described in Algorithm 1.
Algorithm
Input: Neural network f = l ◦ g : X → H → Y , kernel function κ : H 2 → R + , concept positives P c ⊂ X , concept negatives N c ⊂ X
Output: CAR SVC Classifier s cκ : H → { 0 , 1 } s cκ ← SVC( κ ) ; /
* Initialize SVC classifier */
D ← { ( g ( x ) , I P c ( x )) | x ∈ P c (cid:70) N c } ; /*
Assemble SVC training set */ ( s cκ ) .
fit( D ) ; /
* Fit SVC classifier */ return s cκ where I P c is the indicator function on the set P c .
Our implementation leverages the SVC class from scikit-learn [71].
We use the default hyperparameters for each CAR classifier that appears in our experiments.
The resulting classifier s cκ can then be used to assess if a test point x ∈ X has a representation g ( x ) ∈ H that falls in the CAR H c or not:
[Equation]
Choosing the kernel.
Algorithm 1 requires the user to specify a kernel function κ .
To select this kernel, a good approach is to train several SVCs s cκ with different kernels κ and see how each SVC generalizes on a validation set.
We illustrate this process with MNIST in Figure 8.
We note that the Gaussian RBF kernel outperforms the other kernels on the validation set, although the Matern kernel achieves perfect accuracy on the training set.
This highlights the importance of evaluating a
CAR classifier on a held-out dataset to make sure that the related CAR offers a good description of how concepts are distributed in the latent space H .
In our experiments, we found that Gaussian RBF kernels are often the most interesting option.
Concept set size.
Algorithm 1 requires the user to specify concepts sets P c and N c .
What size
N c =
|P c |
= |N c | should we choose for these concept sets?
It seems logical that larger concepts sets are more likely to yield more accurate CARs.
To study this experimentally, we propose to fit several concept classifiers for MNIST by varying the size N c of their training concept sets P c and
[Figure] [Figure]
N c .
We report the results in Figure 9.
As we can see, the curves flatten above N c > 200 .
Increasing the concept sets size beyond this point does not improve the accuracy of the resulting CAR classifier.
We recommend to acquire concept examples until the performance of the CAR classifier stabilizes.
In our experiments, we found that N c
= 200 examples is often sufficient to obtain accurate CAR classifiers.
Tuning hyperparameters.
In the case where the user desires a CAR classifier that generalizes as well as possible, tuning these hyperparameters might be useful.
We propose to tune the kernel type, kernel width and error penalty of our CAR classifiers s cκ for each concept c ∈
[ C ] by using Bayesian optimization and a validation concept set:
Randomly sample the hyperparameters from an initial prior distribution θ h ∼ P prior .
Split the concept sets P c , N c into training concept sets P c train , N c train and validation concept sets P c val , N c val .
For the current value θ h of the hyperparameters, fit a model s cκ to discriminate the training concept sets P c train , N c train .
Measure the accuracy ACC val =
(cid:80) x
[Figure]
( s cκ ◦ g ( x )=1) + (cid:80) x
[Figure]
s cκ ◦
[Figure]
x )=0)
|
[Figure]
Update the current hyperparameters θ h based on ACC val using Bayesian optimization (Optuna in our case).
Repeat 3-5 for a predetermined number of trials.
We applied this process to the CAR accuracy experiment (same setup as in Section 3.1.1 of the main paper) to tune the CAR classifiers for the CUB concepts.
Interestingly, we noticed no improvement with respect to the CAR classifiers reported in the main paper: tuned and standard CAR classifier have an average accuracy of (93 ± .
2)% for the penultimate Inception layer.
This suggests that the accuracy of CAR classifiers is not heavily dependant on hyperparameters in this case.
B TCAR Global Explanations
In this appendix, we provide some details about the TCAR scores.
Implementation.
When the CAR classifiers are available, they permit to compute TCAR scores through Algorithm 2.
TCAR between concepts.
Up until now, we have discussed TCAR scores that indicate how models relate classes to concepts.
It is possible to define a similar score to estimate how models relate two
Input: Neural network f = l ◦ g : X → H → Y , CAR classifier s cκ : H
→
0 , 1 } , set of examples D k ⊂ X of a given class k ∈ [ d Y ]
Output: TCAR score TCAR ck ∈ [0 , 1] count ← 0 ; /
* Initialize concept positive count */ for x ∈ D
k do if s cκ ◦ g ( x ) = 1 then count ← count + 1 ; /
* Increment count if example in the CAR */ end end
TCAR ck ← count / |D k | ; /* Normalize count to get TCAR */ return TCAR ck concepts with each other.
Given a set D ⊂ X of examples, we define the TCAR score associated to the concepts c 1 , c 2 ∈
[ C ] as the ratio
[Equation]
Again, TCAR = 0 corresponds to no overlap and TCAR = 1 describes a perfect overlap.
We note that the concept-concept TCAR score can be interpreted as a Jaccard index between the sets g ( D ) (cid:84)
H cand g ( D ) (cid:84)
H c 2 .
This score is symmetric with respect to the concepts: TCAR c 1 ,c 2 =
TCAR c 2 ,c 1 .
The computation of this score is done as in Algorithm 3.
Algorithm 3:
Input
X
/* Initialize
; /* Initialize score denominator */ for x ∈ D do if s c 1 κ ◦ g ( x ) =
and s c
2 κ ◦ g ( x ) = 1 then numerator ← numerator + 1 ; end if s c 1 κ ◦ g ( x ) = 1 or s c
2 κ ◦ g ( x ) = 1 then denominator ← denominator + 1 ; end end
TCAR
TCAR between MNIST concepts.
As an illustration, we compute concept-concept TCAR scores for the MNIST concepts and report the results in Figure 10.
We see that the model relates concepts that tend to appear together (e.g. curvature and loop).
Hence, concept-concept TCAR scores can serve as a proxy for the concept semantics encoded in a model’s representation space.
We note the similarity with the correlation between concept-based feature importance illustrated in Figure 6.
The main difference is that concept-concept TCAR scores do not explicitly refer to input features.
Generalizing concept sensitivity.
In our formalism, it is perfectly possible to define a local concept activation vector through the concept density ρ c : H → R + defined in Definition 2.1.
Indeed, the vector ∇ h
ρ c [ h ] ∈ H points in the direction of the representation space H where the concept density (and hence the presence of the concept) increases.
Hence, this vector can be interpreted as a local concept activation vector.
Note that this vector becomes global whenever we parametrize the concept density ρ c with a linear kernel κ ( h 1 , h 2 ) =
h ⊺ 1 h 2 .
Equipped with this generalized notion of concept activation vector, we can also generalize the CAV concept sensitivity S ck by replacing the CAV w c by ∇ h ρ c
[ h ] for the representation h
= g ( x ) of the input x ∈ X :
[Equation]
In this way, all the interpretation provided by the CAV formalism are also available in the CAR formalism.
C CAR Feature Importance
In this appendix, we provide some details about our concept-based feature importance.
Implementation.
Concept-based feature importance uses the concept densities ρ c to attribute an importance score to each feature in order to confirm/reject the presence of a concept c ∈ [ C ] for a given example x ∈ X .
This process is described in Algorithm 4.
We stress that features importance scores are computed with concept densities and not with SVC classifiers.
The reason for this is that SVCs are non-differentiable functions of the input and are therefore incompatible with gradient-based attribution methods such as Integrated-Gradients [25].
One could argue that a sparse version of the density ρ c could be used by only allowing support vectors from the SVC to contribute.
Our first implementation was relying on this approach.
Unfortunately, this often led to vanishing importance scores.
A possible explanation is the following: Gaussian radial basis function kernels κ ( h 1 , h 2 ) =
exp (cid:2) − ( γ ∥ h 1 − h 2 ∥ H ) 2 (cid:3) decay very quickly as ∥ h 1 − h
∥ H increases.
Hence, unless the example x we wish to explain has a representation g ( x ) located near a support vector of the SVC classifier, the sparse density (and its gradients) vanishes.
On the other hand, using the density from
Definition 2.1 allows us to incorporate the representations of all concept examples.
This makes it more likely that the representation g ( x ) is located near (at least) one of the representation that contributes to the density.
This permits to solve the vanishing gradient problem that led to vanishing attributions.
It goes without saying that this solution comes at the expense of having to compute a density that scales linearly with the size N c of the concept sets.
In our implementation, we make this tractable by restricting to small concept sets ( N c ≤ 250 ) and by saving the concept sets representations g ( P c ) and g ( N c ) to limit the number of queries to the model.
We use Captum’s implementation of feature importance methods [72].
When using radial basis function kernels, we tune the kernel width γ
[Figure]
with Optuna [73] with 1 , 000 trials so that the Parzen window classifier I R + ◦ ρ c , where I R + denotes the indicator function on R + , accurately discriminates between positives representations g
( P c ) and negative representations g ( N c ) .
Input: Neural network f = l ◦ g : X → H → Y , kernel function κ : H 2 → R + , concept positives P c ⊂ X , concept negatives N c ⊂ X , feature importance method a : A ( R X ) × X
→ R d X , example x ∈ X
Output: Feature importance vector a ∈ R d X for the example x ρ c ← Density( g , κ, P c , N c ) ; /* Initialize concept density as Def.
2.1 */ a ← a ( ρ c ◦ g , x ) ; /* Compute feature importance vector */ return a where A ( R X ) denotes the hypothesis set of scalar functions on the input space X .
In this case, this corresponds to the set of neural networks with input space X and scalar output.
Completeness.
Completeness is a crucial property of some feature importance methods.
It guarantees that the feature importance scores can be used to reconstruct the model prediction.
To make this more precise, let f : X → R be a model with scalar output and let x ∈
X be an example we wish to explain.
Feature importance methods assign a score a i ( f, x ) to each feature
i ∈
[ d X ] .
This score reflects the sensitivity of the model prediction f ( x ) with respect to the component x i of x .
Completeness is fulfilled whenever the sum of this importance scores equals the model prediction up to a constant baseline b ∈ R :
(cid:80) d
X i =
1 a
i ( f, x ) = f ( x ) − b .
The baseline varies from one method to the other.
For instance, Lime [21] uses a vanishing baseline b = 0 , SHAP [24] uses the average prediction b = E X
[ f ( X )] and Integrated Gradients [25] use a baseline prediction b = f
(¯ x ) for some baseline input ¯ x . With completeness, the importance scores a i ( f, x ) are given a natural interpretation: their sign indicates if the features tend to increase/decrease the prediction f ( x ) and their absolute value indicates how important this effect is.
When combined with CAR concept densities ρ c , this interpretation is even more insightful.
Proposition C.1 (CAR Completeness) .
Consider a neural network decomposed as f = l ◦ g , where g : X → H is a feature extractor mapping the input space X to the representation space H and l is a label function that maps the representation space H to the label set Y .
Let ρ c : H → R + be a concept density for some concept c ∈ [ C ] , defined as in Definition 2.1.
Let a : A ( R X ) × X
→ R be a feature importance method satisfying the completeness property: (cid:80) d X i
=
1 a
i ( f, x ) = f ( x ) − b for some baseline b ∈ R and for all x ∈ X .
Then, we have the following completeness property for the concept-based density:
[Equation]
Remark C.1 .
With this property, we can interpret features i ∈
[ d X ] with a i ( ρ c ◦ g , x ) > 0 as those that tend to increase the concept density.
This means that those features are important for the feature extractor g to map the example in a region of the representation space H where the concept is present.
Hence, those are features that are important to identify a given concept c ∈
[ C ] .
Conversely, features i ∈
[ d X ] with a i ( ρ c ◦ g , x ) < 0 tend to decrease the concept density and therefore brings the example x in a region of the representation space H where the concept is absent.
These features can therefore be interpreted as important to reject the presence of a given concept c ∈
[ C ] .
Proof.
We simply note that ρ c ◦ g is a scalar function as ρ c ◦ g ( x ) ∈ R + for all x ∈ X .
Hence, the proposition immediately follows by applying the completeness property to f = ρ c ◦ g .
Input baseline choice.
The choice of baseline input ¯ x has a notable effect on feature importance methods [74].
What constitutes a good input baseline is problem dependant.
Intuitively, ¯ x should correspond to an input x ∈ X where no information is present [55].
Let us now explain how this information removal is achieved with the datasets that we use in our experiments.
1 For MNIST, we chose a black image ¯ x = 0 as an input baseline.
This is because MNIST images have a black background an the information comes from white pixels that represent the digits.
For ECG, we chose a constant ¯ x = 0 time series as an input baseline.
This is because ECG time series are normalized ( x t ∈ [0 , 1] for all t ∈
[ d X ] ) and the pulse information comes from time steps where the time series is non-vanishing x t ̸ = 0 .
3 For CUB, choosing a baseline is more complicated.
The reason for this is that the background colour changes from one image to the other and rarely corresponds to a single colour.
To address this, we proceed as in the literature [22] and select a baseline ¯ x that corresponds to a blurred version of the image we wish to explain: ¯ x ( x ) =
G σ ⊗ x , where G σ is a Gaussian filter of width σ and ⊗ denotes the convolution operation.
We note that this baseline depends on which input x ∈ X we want to explain.
In our implementation, we use σ =to have images that are significantly blurred.
4 For SEER, we chose a constant vector ¯ x = 0 as an input baseline.
This is because all continuous features are standardized and all categorical features are one-hot encoded.
D CAR Latent Isometry Invariance
In this appendix, we prove that CAR explanations are invariant under isometries of the latent space when built with a radial kernel.
Let us first rigorously define the notion of isometry between two vector spaces.
Definition D.1 (Isometry) .
Let ( H , ∥·∥ H ) and ( H ′ , ∥·∥ H ′ ) be two normed vector spaces.
An isometry from H to H ′ is a map τ : H → H ′ such that for all h 1 , h 2 ∈ H :
[Equation]
We say that the two spaces ( H , ∥·∥ H ) and ( H ′ , ∥·∥ H ′ ) are isometric if there exists a bijective isometry τ from H to H ′ .
An explanation method is invariant to latent space isometries if applying a bijective isometry τ to the model’s latent space H does not affect the explanations produced by the method.
To make this more formal, we write the model as f = l ◦ g = l ◦ τ − 1 ◦ τ ◦ g , where τ − 1 is the inverse of the bijective isometry τ .
In this setup, we could produce explanations with CARs by making the following replacements for the feature extractor and the label map: g τ (cid:55)→ τ ◦ g and l τ (cid:55)→ l ◦ τ − 1 .
The explanations are defined to be invariant to latent space isometries if they are unaffected by this replacement.
It is legitimate to expect this since the previous replacement leads to the same model f τ (cid:55)→ f and substitutes the latent space by an isometric latent space H τ
(cid:55)→ H ′ =
τ ( H ) .
Let us now discuss the isometry invariance of CAR explanations.
First, we recall that CARs are defined through a kernel κ .
Not all kernels lead to isometry invariant CAR explanations.
We will show that it holds for a family of kernels known as radial kernels.
Definition D.2 (Radial Kernel) .
A radial kernel is a kernel function κ : H 2 → R + that can be written as
[Equation]
with a function χ : R + → R + .
A typical example of radial kernel is the Gaussian radial basis function kernel (RBF) that corresponds to χ ( x ) = exp (cid:2) − ( γx ) 2 (cid:3) for some γ ∈ R + .
We are now ready to state and prove the isometry invariance property of CAR explanations.
Proposition D.1 (CAR Isometry Invariance) .
Consider a neural network decomposed as f = l ◦ g , where g : X → H is a feature extractor mapping the input space X to the representation space H and l is a label function that maps the representation space H to the label set Y .
Let κ : H 2 → R + be a radial kernel κ ( h 1 , h 2 ) =
χ ( ∥ h 1 − h 2 ∥ H ) that we use to define CAR’s concept density in
Definition 2.1.
Let τ : H → H ′ be a bijective isometry between the normed spaces ( H , ∥·∥ H ) and ( H ′ , ∥·∥ H ′ ) .
All the explanations outputted by CAR remain the same if we transform the latent space with the isometry τ by making the following replacements: g τ (cid:55)→ τ ◦ g and l τ (cid:55)→ l ◦ τ − 1 .
Proof.
For each concept c ∈ [ C ] , we note that CAR explanations exclusively rely on the concept density ρ c from Definition 2.1 and the associated support vector classifier s cκ .
Hence, it is sufficient to show that these two functions are invariant under isometry.
Concept Density.
We start with the concept density ρ c .
We note that the kernel function κ can be applied to vectors from H ′ as κ ′ ( h ′ 1 , h ′ 2 ) ≡ χ ( (cid:13)(cid:13) h ′ 1 − h ′ 2 (cid:13)(cid:13) H ′ )
for all ( h ′ 1 , h ′ 2 ) ∈ H ′ .
Applying
CAR in the latent space H ′ isometric to H corresponds to using this kernel to compute an alternative density ρ ′ c .
Let us fix an example x ∈ X .
Under the isometry, the concept density for this example transforms as ρ c ◦ g ( x ) τ (cid:55)→ ρ ′
c ◦ τ ◦ g ( x ) .
Let us show that this is in fact an invariance:
[Equation]
We deduce that the concept density is invariant under isometry: ρ c ◦ g ( x ) τ (cid:55)→ ρ c ◦ g ( x ) .
SVC.
The proof is more involved for the SVC s cκ .
We assume that the reader is familiar with the standard theory of SVC.
If this is not the case, please refer e.g. to Chapter 7 of [75].
For the sake of notation, we will abbreviate g ( x c,n ) and g ( x ¬ c,n ) by h c,n and h ¬ c,n respectively.
Similarly, we abbreviate τ ◦ g ( x c,n ) and τ ◦ g ( x ¬ c,n ) by h ′ c,n and h ′¬ c,n respectively.
The SVC concept classifier can be written as
[Equation]
where I R + is the indicator function on R + , the real numbers α c,n , α ¬ c,n maximize the objective
[Equation]
under the constraints
[Equation]
Finally, the bias term can be written as
[Equation]
n
[Equation]
(4) where S c = { n ∈
[ N c ] | α c,n ̸ = 0 } and S ¬ c = { n ∈
[ N c ] | α ¬ c,n ̸ = 0 } are the indices of the support vectors.
Under isometry, the SVC classification for a latent vector h ∈ H transforms as s c κ ( h ) τ
(cid:55)→ s ′ c κ ′ ( h ′ ) with h ′ =
τ ( h ) and
[Equation]
We will now show that s cκ ( h )
= s ′ cκ ′ ( h ′ )
so that the SVC is invariant under isometries.
We proceed in 3 steps.
1 We show that κ ′ (cid:2) h ′ 1 , h ′ 2 (cid:3) =
κ
[ h 1 , h 2 ] for any ( h 1 , h 2 ) ∈ H 2 and h ′
= τ ( h 1 ) , h ′ 2 =
τ ( h 2 ) : κ
[Equation]
h ′
[Equation]
, h
[Equation]
By injecting this in (5), we are able to make the following
replacements:
κ
(cid:2) h ′ , h ′ c,n (cid:3) =
κ [ h , h c,n ]
and κ ′ (cid:2) h ′ , h ′¬ c,n (cid:3) = κ [ h , h ¬ c,n ] for all n ∈ [ N c ] .
We show that α ′ c,n = α c,n and α ′¬ c,n = α ¬ c,n for all n ∈
[ N c ] .
To that aim, we note that α ′ c and α ′¬ c maximize the objective L
[Equation]
α
[Equation]
c , α
[Equation]
) =
[Equation]
Since this objective is identical to the one from the original SVC and the constraints are unaffected by the isometry, we deduce that the solution to this convex optimization problem is identical to the solution of (3).
Hence, we have that α ′ c,n = α c,n and α ′¬ c,n = α ¬ c,n for all n ∈
[ N c ] .
Again, we can make these replacements in (5).
3 We show that β ′
=
β .
First, we note that the support vector indices are invariant under isometry:
S ′ c
= { n ∈
[ N c ] | α ′ c,n ̸ = 0 } = { n ∈
[ N c ] | α c,n ̸ = 0 } =
S c and similarly S ′¬ c =
S ¬ c .
Hence we have
[Equation]
By making the replacements from points 1 , 2 and 3 in (5), we deduce that s cκ ( h ) =
s ′
c κ ′ ( h ′ ) .
E Empirical Evaluation
This appendix provides useful details to reproduce the empirical evaluation from Section 3.
Computing Resources.
All the empirical evaluations were run on a single machine equipped with a 18-Core Intel Core i9-10980XE CPU and a NVIDIA RTX A4000 GPU.
The machine runs on Python 3.9 [76] and Pytorch 1.10.2 [77].
Dataset licenses.
The MNIST dataset dataset is made available under the terms of the Creative
Commons Attribution-Share Alike 3.0 License.
The ECG dataset dataset is made available under the terms of the Open Data Commons Attribution License v1.0.
The CUB dataset is made available for non-commercial research and educational purposes.
Models.
The detailed architecture of the models are provided in Tables 2, 3 and 4.
The InceptionV architecture is the same as in the literature [60].
We use its official Pytorch implementation.
Data Split.
All the datasets are naturally split in training and testing data.
In the ECG dataset, the different types of abnormal heartbeats are imbalanced (e.g. the fusion beats constitute only 0 .
7% of the training set).
Hence, we create a synthetic training set with balanced concepts using SMOTE [78].
As in [41], the CUB dataset is augmented by using random crops and random horizontal flips.
Model Fitting.
In fitting each model, we use the test set as a validation set since our purpose is not to obtain the models with the best generalization but simply models that perform well on a set of examples we wish to explain (here the examples from the test set).
All the models are trained to minimize the cross-entropy between their prediction and the true labels.
The hyperparameters are as follows.
For MNIST we use a Adam optimizer with batches of 120 examples, a learning rate of 10 − 3 , a weight decay of 10 − 5 for 50 epochs with patience 10 .
For ECG we use a Adam optimizer with batches of 300 examples, a learning rate of 10 − 3 , a weight decay of 10 − 5 for 50 epochs with patience 10 .
For CUB, we use a stochastic gradient descent optimizer with batches of 64 examples, a learning rate of 10 − 3 , a weight decay of 4 · 10 − 5 for 1 , 000 epochs with patience 50 .
Concepts.
The concept mapping between MNIST classes and concepts is provided in Table 5.
For the
ECG and the CUB datasets, the presence/absence of a concept for each example is readily available in the dataset.
Concept classifiers.
All the concept classifiers are implemented with scikit-learn [71].
For CAR classifiers, we fit a SVC with Gaussian RBF kernel and default hyperparameters from scikit-learn.
For CAV classifiers, we fit a linear classifier with a stochastic gradient descent optimizer with learning rate 10 − 2 and a tolerance of 10 − 3 for 1 , 000 epochs and the remaining default hyperparameters from scikit-learn.
Statistical significance.
The statistical significance test from Section 3.1.1 is performed with the scikit-learn [71] implementation of the permutation test.
For MNIST and ECG, we considerpermutations per concept.
For CUB, this test is more expensive since the latent spaces are highdimensional.
We consider only 25 permutations per concept in that case.
Concept-based feature importance.
In the experiment from Section 2.3, we use Captum’s implementation [72] of Integrated Gradients [25] with default parameters.
In the case of CUB, storing the feature importance scores for each concept and for the whole test set requires a prohibitive amount of memory.
To avoid this problem, we select C = 6 concepts and subsample 50 positive and 50 negative
[Table]
[Table] [Table]
examples per concept from the test set.
This corresponds to a set of 600 examples.
We compute the feature importance for these examples only.
Alternative architecture.
We extended the analysis of Section 3.1.1 to a ResNet-50 architecture.
We fine-tune the ResNet model on the CUB dataset and reproduced the experiment from Section 3.
[Table]
with this new architecture.
In particular, we fit a CAR and a CAV classifier on the penultimate layer of the ResNet.
We then measure the accuracy averaged over the CUB concepts.
This results in (89 ± 1)% accuracy for CAR classifiers and (87 ± 1)% accuracy for CAV classifiers.
We deduce that
CAR classifiers are highly accurate to identify concepts in the penultimate ResNet layer.
As in the main paper, we observe that CAR classifiers outperform CAV classifiers, although the gap is smaller than for the Inception-V3 neural network.
We deduce that our CAR formalism extends beyond the architectures explored in the paper and we hope that CAR will become widely used to interpret any more architectures.
F Use Case
This appendix provides useful details to reproduce the use case from Section 3.2.
Computing Resources.
The use case was run on a single machine equipped with a 18-Core Intel
Core i9-10980XE CPU and a NVIDIA RTX A4000 GPU.
The machine runs on Python 3.9 [76] and
Pytorch 1.10.2 [77].
[Table] [Table]
Dataset license.
The SEER dataset is made available under the terms of the SEER Research Data
Use Agreement.
Model.
The detailed architecture of the model is provided in Table 6.
Data split.
We randomly split the whole SEER dataset into a training set ( 90% of the data) and a test set (the remaining 10% ).
Since patients with a death outcome are in minority (less than 3% ), we oversample them to obtain a balanced training set.
Model fitting.
In fitting the model, we use the test set as a validation set since our purpose is not to obtain the model with the best generalization but simply a model that performs well on a set of examples we wish to explain (here the examples from the test set).
The model is trained to minimize the cross-entropy between its prediction and the true labels.
We use a Adam optimizer with batches of 500 examples, a learning rate of 10 − 3 , a weight decay of 10 − 5 for 500 epochs with patience 50 .
Concepts.
The concepts correspond to prostate cancer grades.
Those grades can be computed from the Gleason score as follows [70]:
[Equation]
It goes without saying that the model is trained with the Gleason scores only, not with the grades.
Concept classifiers.
We fit a SVC with linear kernel and default hyperparameters from scikit-learn.
Concept-based feature importance.
We use Captum’s implementation [72] of Integrated Gradients [25] with default parameters.
G Explanation Robustness
Adversarial perturbations.
We perform an experiment to evaluate the robustness of CAR explanations with respect to adversarial perturbations.
In this experiment, we work with the MNIST dataset in the same setting as the experiment from Section 3.1.2.
We train a CAR concept classifier for each
MNIST concept c ∈ [ C ] .
We use the CAR classifier to output TCAR scores relating the concept c with each class k ∈ [ d Y ] .
As in the main paper, since the ground-truth association between concepts and classes is known (e.g. the class corresponding to digit 8 will always have the concept loop), we can compute the correlation r (TCAR , TrueProp) between our TCAR score and the ground-truth proportion of examples that exhibit the concept.
In this experiment, the correlation is evaluated on a test set D test =
D adv ⊔ D orig that contains adversarial test examples D adv and original test examples D orig .
Each adversarial MNIST image x adv ∈
D
adv is constructed by finding a small (w.r.t.
the ∥ · ∥ ∞ norm) perturbation ϵ ∈ R
d
X around an original test image x ∈ X that maximizes the prediction shift for the model f : X → Y :
[Equation]
[Table]
The adversarial image is then defined as x adv ≡ x + ϵ .
We measure the correlation r (TCAR , TrueProp) by varying the proportion |D
adv | |D test | of adversarial examples in the test set.
The results are reported in Table 7.
We observe that the TCAR scores keep a high correlation with the true proportion of examples that exhibit the concept even when all the test examples are adversarially perturbed.
We conclude that
TCAR explanations are robust with respect to adversarial perturbations in this setting.
Background shift.
For completeness, we have also adapted the background shift robustness experiment in Section 7 from [27].
We use CAR to explain the predictions of our Inception-V3 model trained on the original CUB training set.
The explanations are made on test images where the background has been replaced.
As [27], we use the segmentation of the CUB dataset to isolate the bird on each image.
The rest of the image is replaced by a random background sampled from the Place365 dataset [80].
This results in a test set D test with a background shift with respect to the training set.
By following the approach from Section 3.1.2 of our paper, we measure the correlation r (TCAR , TrueProp) between the TCAR score and the true proportion of examples in the class that exhibit the concept for each (class , concept) pair.
We measured a correlation of r (TCAR , TrueProp) = .
82 in the background-shifted test set.
This is close to the correlation for the original test set reported in the main paper, which suggests that CAR explanations are robust with respect to background shifts.
Note that this correlation is still better than the one obtained with TCAV on the original test set.
H Using CAR to Understand Unsupervised Concepts
Our CAR formalism adapts to a wide variety of neural network architectures.
In this appendix, we use CAR to analyze the concepts discovered by a self explaining neural network (SENN) trained on the MNIST dataset.
As in [81], we use a SENN of the form
[Equation]
Where g s ( x ) and θ s ( x ) are respectively the activation and the relevance of the synthetic concept s ∈ [ S ] discovered by the SENN model.
We follow the same training process as [81].
This yields a set of S = 5 concepts explaining the predictions made by the SENN f : X → Y .
We use our CAR formalism to study how the synthetic concepts s ∈ [ S ] discovered by the SENN are related to the concepts c ∈ { Loop , Vertical Line , Horizontal Line , Curvature } introduced in our paper.
With our formalism, the relevance of a concept c for a given prediction x (cid:55)→ f ( x ) is measured by the concept density ρ c ◦ g ( x ) .
To analyze the relationship between the SENN concept s and the concept c , we can therefore compute the correlation of their relevance:
[Equation]
When this correlation increases, the concepts s and c tend to be relevant together more often.
We report the correlation between each pair ( s, c ) in Table 8.
We note the following:
[Table]
SENN Concept 2 correlates well with the Vertical Line Concept.
SENN Concept 3 correlates well with the Horizontal Line Concept 3.
SENN Concept 5 correlates well with the Loop Concept.
SENN Concepts 1 and 4 are not well covered by our concepts.
The above analysis shows the potential of our CAR explanations to better understand the abstract concepts discovered by SENN models.
We believe that the community would greatly benefit from the ability to perform similar analyses for other interpretable architectures, such as disentangled VAEs.
I Using CAR with NLP
CAR is a general framework and can be used in a wide variety of domains that involve neural networks.
In the main paper, we show that CAR provides explanations for various modalities:
Large image dataset 2.
Medical time series 3.
Medical tabular data
We now perform a toy experiment to assess if those conclusions extend to the NLP setting.
We train a small CNN on the IMDB Review dataset to predict whether a review is positive or negative.
We use GloVe [82] to turn the word tokens into embeddings.
We would like to assess whether the concept c
= Positive Adjective is encoded in the model’s representations.
Examples that exhibit the concept c are sentences containing positive adjectives.
We collect a positive set P c of N c =such sentences.
The negative set N c is made of N c sentences randomly sampled from the Gutenberg
Poem Dataset.
We verified that the sentences from N c did not contain positive adjectives.
We then fit a CAR classifier on the representations obtained in the penultimate layer of the CNN.
We assess the generalization performance of the CAR classifier on a holdout concept set made of
N c = 30 concept positive and negative sentences (60 sentences in total).
The CAR classifier has an accuracy of 87% on this holdout dataset.
This suggests that the concept c is smoothly encoded in the model’s representation space, which is consistent with the importance of positive adjectives to identify positive reviews.
We deduce that our CAR formalism can be used in a NLP setting.
We believe that using CARs to analyze large-scale language model would be an interesting study that we leave for future work.
J Increasing Explainability at Training Time
Improving neural networks explainability at training time constitutes a very interesting area of research but is beyond the scope of our paper.
That said, we believe that our paper indeed contains insights that might be the seed of future developments in neural network training.
As an illustration, we consider an important insight from our paper: the fact that the accuracy of concept classifiers seems to increase with the depth of the layer for which we fit a classifier.
In the main paper, this is mainly reflected in Figure 4.
This observation has a crucial consequence: it is not possible to reliably characterize the shallow layers in terms of the concepts we use.
In order to improve the explainability of those shallow layers, one could leverage the recent developments in contrastive learning.
The purpose of this approach would be to separate the concept set
P c and N c in the representation space H corresponding to a shallow layer of the neural network.
A practical way to implement this would be to follow [79].
Assume that we want to separate concept positives and negatives in the representation space H induced by the shallow feature extractor g : X → H .
As [79], one can use a projection head p : H → Z and enforce the separation of the concept sets through the contrastive loss
[Equation]
where cos( z 1 , z 2 ) ≡
[Equation]
·∥ z 2 ∥ 2 and τ ∈ R + is a temperature parameter.
The effect of this loss is to group the concept positive examples from P c together and apart from the concept negatives N c in the representation space H .
To the best of our knowledge, concept-based contrastive learning has not been explored in the literature.
We believe that it would constitute an interesting contribution to the field based on the insights from our paper.
K Further Examples
In this appendix, we provide several examples to illustrate the experiments from Section 3.
Concept classifiers.
The accuracy of the concept classifiers for all the MNIST and ECG concepts are given in Figures 11 and 12.
Each box-plot is built with 10 random seeds where the concept sets P c and N c are allowed to vary.
We observe that the CAR classifiers are more accurate for each of the observed concepts
Global explanations.
The global concept explanations for all the MNIST concepts and some of the CUB concepts are given in Figures 13 and 14.
As the examples from Section 3.1.2, we see that
TCAR explanations are more consistent with the human concept annotations.
Saliency maps.
Examples of concept-based an vanilla saliency maps for MNIST, ECG and CUB examples are given in Figures 15 , 16 , 17 , 18 and 19.
As explained in the main paper, we observe that concept-based saliency maps are indeed distinct form vanilla saliency maps.
Furthermore, saliency maps for different concepts are not interchangeable.
In the CUB case, we note that concept are not always identified with the minimal amount of features (e.g. some of the saliency maps from Figurehighlight pixels that do not always belong to the bird’s breast).
This surprising observation seems to occur even for concept-bottleneck models that are explicitly trained to recognize concepts [44].
We believe that this could be improved by training concept classifiers with images that include a segmentation highlighting the concept of interest (e.g. the bird’s breast).
We leave this idea for future works.
[Figure]
a l L i n
[Figure]
[Figure]
n c e p t
S u p r a v e n t r i c u l a r
A cc u r a c y
[Figure]
C o n c e p t F u s i o n
B e a t s A cc u r a c y
[Figure]
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(a) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(b) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(c) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(d) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(e) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class: 5 Method
TCARTCAVTrue Prop.
(f) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(g) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
S c
o r e
Class:
Method
TCARTCAVTrue Prop.
(h) Class
Loop
VerticalLine
HorizontalLine Curvature Concept 0.
[Figure] [Figure]
colour
[Figure]
[Figure] [Figure]
Pied
[Figure]
[Figure] [Figure]
[Table] [Table]
[Table]
175 Time 0.0 0.2 0.4 0.
0.8 1.0 V o l t a g e       175 Time 0.0 0.2 0.4 0.
0.8 1.0 V o l t a g e       175 Time 0.0 0.2 0.4 0. 0.8 1.0 V o l t a g e       175 Time 0.0 0.2 0.4 0.
0.8 1.0 V o l t a g e 4 2 0 2
I m p o r t a n c e 4 2 
 I m p o r t a n c e 4 2
I m p o r t a n c e 4
I m p o r t a n c e 5.0 2.5 0.0 2.5 5.0 I m p
o r t a n c e
[Figure] [Figure]
[Figure] [Figure]