Skip to content

Contents


Model Interpretability

This section refers to the most accurate multimodal model trained, CNN 3 (see CNN Multimodal – CNN Model 3).

Interpretability of the Image Branch with Grad-Cam

Let's first look at the model interpretability of the image branch.

Grad-Cam Script Overview

The script first loads the validation data and merges it with the corresponding product labels. It then constructs the full file paths for each image based on its product and image ID. A random sample of images is selected from the validation set to provide a representative overview of model behavior. For each sampled image, the script loads the image and passes it through the trained model.

Grad-CAM is applied to the last convolutional layer to generate a heatmap that highlights the regions most relevant to the model's prediction. The resulting heatmap is overlaid on the original image and both are saved for visual inspection.

Grad-Cam Results (Sample)

Image interpretability is important because it allows us to verify that the model is using relevant visual features, such as contours and main objects, rather than background or empty spaces.

The Grad-CAM results below show that the model generally highlights the main features of the images.

Images 742113432, 1242235356, and 1308731891 are particularly good examples, where the highlighted regions closely match the main object in the original image.

Original image 742113432 of product 1217640Grad-CAM image 742113432 of product 1217640

Left: Original image 742113432 of product 1217640.
Right: Grad-CAM image of image 742113432 of product 1217640.


Original image 1242235356 of product 3716120648Grad-CAM image 1242235356 of product 3716120648

Left: Original image 1242235356 of product 3716120648.
Right: Grad-CAM image of image 1242235356 of product 3716120648.


Original image 1308731891 of product 4177821854Grad-CAM image 1308731891 of product 4177821854

Left: Original image 1308731891 of product 4177821854.
Right: Grad-CAM image of image 1308731891 of product 4177821854.

Interpretatbility of the Text Branch with SHAP

Text 1: revue encyclopedique ° 43 15/09 1892 academies societes savantes trawinski tassilly maison zaborowski mellion bertrand petit pellissier grand-carteret 45 gravures archeologie orient grece rome revue encyclopedique ° 43 15/09 1892 academies societes savantes trawinski tassilly maison zaborowski mellion bertrand petit pellissier grand-carteret 45 gravures archeologie orient grece rome

Text1040506011401160118012801281130013011302132015601920194020602220228024032462252225822583258527052905
revue encyclopedique ° 43 15/09 1892 academies societes savantes trawinski tassilly maison zaborowski mellion bertrand petit pellissier grand-carteret 45 gravures archeologie orient grece rome revue encyclopedique ° 43 15/09 1892 academies societes savantes trawinski tassilly maison zaborowski mellion bertrand petit pellissier grand-carteret 45 gravures archeologie orient grece rome-0.0331-0.0012-0.0004-0.0001-0.0038-0.0024-0.0054-0.0532-0.0039-0.0516-0.0008-0.0014-0.0324-0.1491-0.0330-0.0005-0.0932-0.00040.70220.0992-0.0025-0.0692-0.0225-0.1981-0.04360.0004-0.0000

Text 2: saison chez lévy saison chez lévy

Text1040506011401160118012801281130013011302132015601920194020602220228024032462252225822583258527052905
saison chez lévy saison chez lévy0.34350.02230.00740.00090.0012-0.00010.0025-0.0496-0.0012-0.0499-0.0001-0.00110.0106-0.1480-0.02300.0027-0.0919-0.0001-0.02810.28340.0356-0.0653-0.0221-0.1991-0.04330.01290.0001

Text 3: noces feeriques disney noces feeriques disney

Text1040506011401160118012801281130013011302132015601920194020602220228024032462252225822583258527052905
noces feeriques disney noces feeriques disney0.22840.02920.01290.00150.06400.00930.10680.05820.0404-0.03390.00380.01070.0970-0.1460-0.02320.0026-0.09090.0004-0.0453-0.04490.0425-0.0618-0.0215-0.1986-0.04360.00180.0004

Text 4: plongeoir dynamic flexible 1.61 bleu marine plongeoir couleur blanche polyester armé fibre verre recouvert gelcoat isoftalmique plus résistance livré ancrages dimensions measurement_value

Text1040506011401160118012801281130013011302132015601920194020602220228024032462252225822583258527052905
plongeoir dynamic flexible 1.61 bleu marine plongeoir couleur blanche polyester armé fibre verre recouvert gelcoat isoftalmique plus résistance livré ancrages dimensions measurement_value0.0031-0.00070.00030.00010.0637-0.00080.01050.0114-0.0000-0.03780.01020.06870.0950-0.11380.01140.0127-0.03010.0020-0.0441-0.1026-0.00040.05580.0290-0.0395-0.0040-0.00090.0008

Text 5: cadre peinture acrylique measurement_value l'huile toile apprêtée mélange lin cadre peinture acrylique measurement_value l'huile toile apprêtée mélange lin type peinture toile utilisation peinture numéro modèle bcf 12210 age > 3 ans taille measurement_value nom marque conda matériel lin matière lin type cadre cadre grande taille utilise épaisseur élargie caractéristiques 1 technologie tissu strerch professionnel tissu base lin texture claire image peinte 2 peut peindre correctement applicable convient peintures huile pigments acryliques peintures alkydes applicable convient peintures huile pigments acryliques peintures alkydes poids paquet paquet poids measurement_value quantité carton 21 poids carton measurement_value taille carton measurement_value * measurement_value * measurement_value

Text1040506011401160118012801281130013011302132015601920194020602220228024032462252225822583258527052905
cadre peinture acrylique measurement_value l'huile toile apprêtée mélange lin cadre peinture acrylique measurement_value l'huile toile apprêtée mélange lin type peinture toile utilisation peinture numéro modèle bcf 12210 age > 3 ans taille measurement_value nom marque conda matériel lin matière lin type cadre cadre grande taille utilise épaisseur élargie caractéristiques 1 technologie tissu strerch professionnel tissu base lin texture claire image peinte 2 peut peindre correctement applicable convient peintures huile pigments acryliques peintures alkydes applicable convient peintures huile pigments acryliques peintures alkydes poids paquet paquet poids measurement_value quantité carton 21 poids carton measurement_value taille carton measurement_value * measurement_value * measurement_value-0.0630-0.0012-0.0004-0.0001-0.0048-0.0026-0.0054-0.0529-0.0039-0.0521-0.0007-0.0006-0.00890.11190.2273-0.00020.27890.0003-0.0481-0.1106-0.0024-0.06480.0418-0.1974-0.0390-0.0011-0.0000

Limitations of SHAP

With the current model architecture, SHAP cannot provide word-level attributions for text inputs.

This is because the model expects raw text strings as input and performs tokenization internally using a TextVectorization layer.

As a result, SHAP treats the entire text as a single feature, rather than a sequence of words or tokens.

Consequently, SHAP can only assign importance to the whole text input, not to individual words.

For word-level attributions, the model must accept pre-tokenized input (such as integer sequences), enabling SHAP to perturb or mask individual tokens and measure their effect on the prediction.

Interpretatbility of the Text Branch with LIME

LIME (Local Interpretable Model-agnostic Explanations) is an interpretability tool designed to explain individual model predictions.

For text data, LIME generates multiple variations of the input by removing or masking specific words and observes the resulting changes in the model’s output. This approach identifies which words have the greatest influence on the prediction for each class.

The output is a set of importance scores or highlights for each word, indicating their contribution to the model’s decision. Positive scores indicate words that push the prediction toward the class, while negative scores indicate words that push it away.

LIME is model-agnostic and can be applied to any model that accepts raw text as input.

LIME for Text Samples

Each time the script is run, it randomly selects a single text sample from the validation set. This random sampling ensures that different runs can provide explanations for different examples, offering a broader view of model behavior across the dataset.

Example Output

LIME explanation for predicted class 2583

WordImportance
piscine0.7515
kerlis0.0599
aquatique0.0518
gonflable0.0343
fauteuils0.0140
deux-0.0558
fluo-0.0382
fauteuil-0.0366
stables-0.0283
pool-0.0116

Text: fauteuil gonflable piscine fluo pool pod kerlis très stables deux fauteuils transforment piscine salon aquatique assortiments deux couleurs

Global LIME across all classes

The global LIME analysis provides an overview of which words are most influential for each class across the entire dataset, rather than for a single prediction.

100 text samples were randomly selected from the validation set. For each sample, LIME generates explanations for every class by perturbing the text and observing how the model’s predictions change. The script then aggregates the absolute importance scores for each word across all samples and all explanations for a given class. This aggregation highlights the words that, on average, have the greatest impact on the model’s predictions for each class. The result is a ranked list of the top influential words for every class, offering insight into the global decision patterns of the model.

Top 5 Influential words globally by class (sample of 100 texts)

ClassWordAggregate Importance
10measurement_value0.9361
lot0.6779
xbox0.6311
maquette0.6229
console0.6079
40jeu0.1452
nintendo0.1258
version0.1193
gamecube0.1186
windows0.0839
50téléchargement0.4375
jeu0.2791
version0.2778
gamecube0.2238
wii0.1452
60console0.1848
jeu0.0735
téléchargement0.0612
rebelle0.0528
system0.0395
1140kamen0.7320
figurine0.6798
magnet0.6508
colorful0.2691
japan0.2170
1160mtg0.8536
yu0.8417
attax0.7854
commune0.7552
magic0.6898
1180téléchargement0.1565
mtg0.1154
jeu0.1129
magic0.1098
console0.0876
1280générique1.4210
toy0.5272
téléchargement0.4761
magnet0.4311
électronique0.3650
1281téléchargement0.4394
jeu0.3956
supplies0.1277
toy0.0908
solaire0.0804
1300générique1.7283
maquette0.9872
téléchargement0.5475
livre0.5420
jeu0.5054
1301piscine0.0748
promo0.0590
measurement_value0.0452
hors0.0258
attax0.0224
1302stream2.7236
jeu0.7602
nerf0.5095
gonflable0.2590
chien0.2225
1320draeger0.4185
bébé0.3414
measurement_value0.2486
éducatif0.2167
électronique0.1978
1560stream0.5916
germenly0.3400
measurement_value0.2822
chêne0.2031
cellule0.2002
1920coussin0.8545
drap0.6854
coton0.5496
stream0.4901
oreiller0.3936
1940paquet0.1186
citron0.0998
measurement_value0.0716
piscine0.0510
d0.0288
2060stream0.8333
coussin0.4806
d0.4262
germenly0.3988
measurement_value0.2949
2220chien0.8458
idéal0.0551
chat0.0541
stream0.0499
permanence0.0496
2280dossier0.2815
sauvage0.2462
vo0.2295
presse0.1748
19600.1739
2403lot1.2401
volumes0.6616
livre0.4284
travail0.4117
livres0.3891
2462console1.3615
xbox0.8702
jeu0.2467
attax0.2258
version0.2246
2522draeger0.8600
classement0.7412
stylo0.6201
chemises0.5750
piscine0.4809
2582measurement_value0.5715
piscine0.3209
dîner0.3145
teck0.2737
stream0.2693
2583piscine1.9446
cellule0.9374
bayrol0.9266
condensateur0.7608
jeu0.6521
2585measurement_value0.4861
tronçonneuse0.4615
lien0.4209
silencieux0.2497
spa0.2490
2705livre0.2872
0.2024
l0.1829
mauvaise0.1418
etats0.1369
2905téléchargement2.3772
jeu0.2222
utiliser0.1147
note0.0917
dlc0.0865

Top 5 Influential words globally by class (sample of 600 texts)

ClassWordAggregate Importance
2583 (2)piscine16.1992
measurement_value2.1359
m31.8849
chlore1.8514
douche1.6516
1302stream10.3993
jeu1.6673
trampoline1.1178
measurement_value0.6299
coussin0.5864
1300générique8.4748
maquette2.7140
ho1.1105
téléchargement1.0943
drone1.0915
1140figurine6.4371
pop1.1628
kamen0.7337
logo0.6567
measurement_value0.6488
1280générique5.6198
measurement_value1.6851
doudou1.6472
toy1.4146
jouets1.3362
1920coussin5.7599
taie4.2629
oreiller2.3914
piscine1.2464
stream1.1891
2905 (1)téléchargement5.3811
jeu0.4039
utiliser0.2055
note0.2050
propos0.1506
10measurement_value4.5938
lot2.9278
figurine2.2096
livres1.6262
vf1.4783
2403lot4.0343
livres2.6407
volumes1.8383
measurement_value1.7270
figurine1.3451
2060lampe2.8920
stream2.8815
taie2.5881
coussin2.4300
piscine2.3741
1320bébé2.9919
measurement_value1.9311
poussette1.4738
d0.9074
doudou0.6889
2585piscine3.2275
measurement_value2.1295
stream1.2226
outil0.9295
tondeuse0.9266
2582piscine3.0865
measurement_value2.6044
stream2.1300
jardin1.6949
d1.0211
2462xbox2.1025
console2.0692
jeux1.7040
psp1.5831
lot1.0744
1160vf2.5338
carte2.1621
pokemon2.1582
mtg1.8446
commune1.4598
1560supplies1.5151
matelas1.3829
measurement_value1.3307
stream1.2944
coussin1.1387
1281jeu1.6474
game1.2123
téléchargement1.1717
warhammer0.6821
jeux0.4971
2522 (3)stylo1.6847
measurement_value1.6431
draeger1.5950
lindner1.3435
agenda0.9237
50téléchargement0.9691
psp0.9349
wii0.6580
jeu0.5847
joystick0.5637
2220chien1.7897
chat0.4242
stream0.2425
measurement_value0.2190
piscine0.1983
40version0.9174
import0.4959
jeu0.3922
japan0.3556
edition0.3031
1940bio0.7374
sucre0.4538
measurement_value0.4194
piscine0.1721
dosettes0.1464
2280sauvage0.6107
paris0.4537
parisien0.3684
magazine0.3645
rail0.3538
27050.3506
tome0.2975
comme0.2934
livre0.2898
entre0.2761
1180warhammer1.1357
téléchargement0.3407
jeu0.3322
edition0.2699
mtg0.2695
1301piscine0.1058
measurement_value0.0978
warhammer0.0865
carte0.0765
10.0753
60console0.3345
téléchargement0.1392
jeu0.1298
game0.1076
ecran0.0560

(1) – Class with highest F1 score in predictions (2) – Class with second highest F1 score in predictions (3) – Class with third highest F1 score in predictions