## 3 Methodology
### Gradient/Deep Explainer Based Strategy for Feature Selection  
We employed a strategy that uses SHAP values [33] from Shapley Additive exPla-nation methods: (1) Gradient Explainer; and (2) Deep Explainer to rank and filter the irrelevant features. The Gradient Explainer combines the ideas from Integrated Gradients, SHAP, and Smooth Grad into a single expected equation. It approximates the model as a linear function between each background data sample and input feature vector. The attributes are assumed to be independent of each other and then expected gradients compute approximate SHAP values. Similarly, Deep Explainer builds a connection with Deep Lift to calculate the SHAP values of a deep learning model. It computes SHAP values by assuming that input attributes are independent of one another. The deep model is linear, and this approach combines SHAP values of smaller components of the network into the whole network's SHAP values. Equation (3) computes the linear approximation. \[\phi_{i}(f_{3},y)\approx m_{y_{i}}f_{3}(y_{i}-E[y_{i}]). \tag{3}\]  
SHAP values of both techniques integrate the conditional expectations with game theory and classic Shapley values to assign the \(\phi_{i}\) values to the attributes of the feature vector. Their explanation model \(e\) satisfies the three properties of (1) Local accuracy; (2) Missingness; and (3) Consistency, as shown in Equation (4). \[\phi_{i}=\sum_{S\subseteq N\setminus\{i\}}\frac{|S|!(M-|S|-1)!}{M!}[f_{x}(S \cup\{i\}-f_{x}(S))]. \tag{4}\]  
Here, \(f_{x}(S)=f(h_{x}(z^{{}^{\prime}}))=E[f(x)|x_{s}]\), \(S\) represents the set of non-zero indexes in \(z^{{}^{\prime}}\) where \(z^{{}^{\prime}}\in\{0,1\}^{M}\). \(E[f(x)|x_{s}]\) is the expected value of the function conditioned on a subset \(S\) of the input features, \(M\) indicates the number of features and \(N\) refers to the set of all input features. Feature Selection Steps for High-Dimensional Class-Imbalanced Image Data  
The proposed algorithm uses the SHAP score values from the Gradient Explainer and Deep Explainer to measure the importance of each attribute for the output layer. For food category and ingredient detection, we compute the SHAP values of each food image in the training dataset from the max-pooling layer (8, 8, 1536) of the InceptionResNetV2 model. The ranked output parameter value is 1 for all food category datasets. As there are multiple labels in multilabel classification for ingredients detection, the ranked output parameter  
Figure 3: Quality resilient convolutional neural network (CNN) to extract visual features. value is the average number of ingredients in the dataset. After that, we applied average pooling to obtain a single vector (1, 1536) of each image for food category datasets. In the case of food ingredient datasets after average pooling, we will get vectors equal to the ranked outputs, so we took the average of these vectors to get the single vector. The SHAP score \(\varphi^{c}\) of each food class \(c\) is the average SHAP scores of the training instances belonging to that class. Equation (5) represents the mathematical form to compute the SHAP score of each food class. \[\varphi^{c}=\frac{\sum_{i=1}^{i=t}\phi^{i}}{t}, \tag{5}\]  
where \(\phi^{i}\) refers to the SHAP score vector of ith training instance and \(t\) refers to the total images in the class. Then, we computed the SHAP score of each attribute as in Equation (6) by taking the mean of each class SHAP score vector. \[A=\frac{\sum_{i=1}^{i=c}\varphi^{i}}{c}. \tag{6}\]  
Here, \(\varphi^{i}\) refers to the SHAP score vector of the ith food class, and \(c\) refers to the total number of food classes. Following that, the feature selector ranks the attributes and selects the 500 attributes with the highest score. Algorithm 1 shows steps of the feature selection method. Figure 4 diagrammatically illustrates the process of feature selection. In the results section, the article presented the results of the performance comparison of the proposed feature selection strategy with a classical ReliefF method for all the food datasets.