# C-SHAP: A Hybrid Method for Fast and Efficient Interpretability
## 4 How C-SHAP Improves SHAP's Performance  
In this study, we introduce C-SHAP, a hybrid approach designed to improve SHAP's execution time while maintaining its interpretability. C-SHAP enhances SHAP by preserving its core interpretability features while making the process more efficient. Specifically, C-SHAP leverages K-means clustering to group similar data points into clusters, allowing SHAP to evaluate representative clusters rather than each data point individually. The pseudocode corresponding to the implemented code is presented below (Algorithm 1). To show the connection between K-means clustering and SHAP in C-SHAP, we introduce a formula that reflects how data points are clustered first using K-means, and then SHAP values are computed for each cluster's centroid rather than for individual data points. Let  
* \(X\) be the dataset with \(n\) samples and \(m\) features. * \(C_{k}\) represent the \(k\)-th cluster centroid derived from K-means clustering, where \(k\in\{1,2,\ldots,K\}\) is the number of clusters. The SHAP values for C-SHAP, \(\phi_{i}(C_{k})\), can be computed by applying SHAP to the centroid of each cluster, rather than individual data points. The process involves  
\[\phi_{i}(C_{k})=\sum_{S\subseteq N\setminus\{i\}}\frac{|S|!(|N|-|S|-1)!}{|N|!}(v (S\cup\{i\},C_{k})-v(S,C_{k}))\]  
Here,  
\(C_{k}\) is the centroid of the \(k\)-th cluster found by K-means. \(v(S,C_{k})\) represents the model's output when using the feature subset \(S\) for the centroid \(C_{k}\). \(\phi_{i}(C_{k})\) is the SHAP value for feature \(i\) in the cluster \(C_{k}\). To illustrate the effectiveness of C-SHAP in a regression context, four critical factors in predicting diabetes outcomes, Body Mass Index (BMI), age, sex, and blood pressure (bp), were selected for analysis. In Figure 1, the feature importance rankings are displayed for SHAP, C-SHAP, and LIME. The feature ranked as number one, highlighted in blue, is identified as the most important according to SHAP values. In contrast, the feature ranked as number four, marked in red, is considered the least important based on SHAP values. To simplify the analysis in this toy example, four out of the ten available features in the Diabetes dataset were selected solely for illustrating feature importance rankings. While the full regression model utilized all features for predicting diabetes outcomes, these four were specifically chosen to demonstrate how feature importance rankings are assigned by SHAP, C-SHAP, and LIME. The order of importance for SHAP and C-SHAP is identical, while LIME shows a slight variation in the feature rankings. In Figure 2, the SHAP values for each feature are shown for both the SHAP and C-SHAP methods. The similarity in these values indicates that both methods produce consistent feature importance rankings. This alignment confirms that C-SHAP can reliably replicate the insights provided by SHAP while maintaining accuracy in assessing the significance of each feature. The images in Figures 3 and 4 represent a small slice of decision trees generated using SHAP and C-SHAP, respectively. Each node in these trees corresponds to a decision point based on the bmi and bp features. Each node in the decision trees provides key details about the decision-making process, represented in four rows:Figure 1: Feature importance rankings in SHAP, C-SHAP, and LIME. Figure 3: Decision tree of SHAP approach. Figure 2: SHAP values for the SHAP and C-SHAP approaches are compared across four features. * Condition (top row): This specifies the splitting criterion at the node, based on a feature. For example, in Figure 3, \"bmi \(\leq\) 0.005\" is a decision point that splits data based on the BMI feature. In Figure 4, the decision point for the root node is \"bmi \(\leq-0.023\).\"
* SHAP value (second row): This value represents the predicted output or cumulative SHAP contribution at the node.